Tuesday, August 30, 2022

[SOLVED] centos 7 laravel log - everyday new log file instorage gets created owned by root need apache to be owner of log file

Issue

I have this strange issue on Cent os 7, where i have installed laravel .

I have installed apache httpd server and granted access to the laravel Logs directory .

Everything works fine if I set the owner of the log files to apache.

So what happens is laravel creates a new log file daily in the storage folder and when it does all of a sudden the owner of that new log file for example laravel-2020-05-22.log is no longer apache but root.

So thats my issue , I have to everyday go to the log file and change its owner from root to apache for it to work.

sudo chown -R apache:apache /var/www/html/laravel/storage/logs

I have already executed the command to make apache the owner of the logs directory recursively.

How do i make the new logs that are being created daily be automatically owned by apache and not root ?


Solution

The easiest hassle free way to solve it was to stop logs from being written into the storage folder and just save it into a logging database instead.



Answered By - user3548161
Answer Checked By - Marie Seifert (WPSolving Admin)