Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alnouirah's avatar

Laravel on load balancer and central logging file

Hi all. I have managed to run two laravel applications on a load balancer so every one of them has its own log file . reading and searching throw the two files is very hard. Is there a way to register the logs into one single file?

notes: I don't want to register the log to the database cuz the data is huge the files are the ideal way.

0 likes
8 replies
Tray2's avatar

You can try put the log directory on a mounted network share that way it will be centralized, however be aware the you might get issues with the file being locked by the other server.

2 likes
alnouirah's avatar

@Tray2 Thanks for your reply. That's a general answer, what I want is a little more detailed answer ( steps ) on how to do it πŸ˜….

alnouirah's avatar

@Tray2 Thanks a lot for the resource I have enjoyed reading through this subject (NFS ). so, I have a little note about what I learned. NFS is perfect for sharing storage across servers and clients but when clients open files then it will be locked till finished ! in my case, I'm developing a system that may have hundreds of thousands of requests per day and in every request, there is a lot to log ! which means this issue will be a bottleneck for me 😣. is there another way of doing that !!

martinbean's avatar

@alnouirah Laravel has support for many logging providers. Open up your config/logging.php file. You can use something like Papertrail, or Bugsnag, or Sentry, to pipe logs to one central location.

2 likes
alnouirah's avatar

Hello all, The reason why I want to centralize the log to a single file is for debugging by using this package ARCANEDEV-LogViewer. so all the solutions mentioned above didn't work for me. Even after doing a massive search about this subject, I didn't find the solution I want. Thanks all for your help and suggestions.

Please or to participate in this conversation.