We’re running some Laravel commands using Supervisor on our server. Each program writes to a log file in storage/logs.
The issue is that whenever a Supervisor rotates or creates a new log file, it’s being created with restrictive permissions -rw-r--r--
.
What we need:
All log files should always be created with 0666 or 0777 permissions.
The log files should not be owned by root, but instead by the www-data user.
How can we configure Supervisor (or the environment) so that new log files created by these processes always use those permissions?
Example issue:
-rwxrwxrwx 1 root root 5187 Aug 28 23:00 laravel-2025-08-28.log
-rwxrwxrwx 1 root root 6780 Aug 29 23:00 laravel-2025-08-29.log
-rwxrwxrwx 1 root root 7087 Aug 30 23:01 laravel-2025-08-30.log
-rwxrwxrwx 1 root root 7295 Aug 31 23:00 laravel-2025-08-31.log
-rwxrwxrwx 1 root root 8282 Sep 1 23:00 laravel-2025-09-01.log
-rwxrwxrwx 1 root root 8282 Sep 2 23:00 laravel-2025-09-02.log
-rwxrwxrwx 1 root root 6966 Sep 3 23:00 laravel-2025-09-03.log
-rwxrwxrwx 1 root root 7295 Sep 4 23:00 laravel-2025-09-04.log
-rwxrwxrwx 1 root root 9690 Sep 5 23:00 laravel-2025-09-05.log
-rwxrwxrwx 1 root root 8533 Sep 6 23:00 laravel-2025-09-06.log
-rwxrwxrwx 1 root root 7771 Sep 7 23:00 laravel-2025-09-07.log
-rwxrwxrwx 1 root root 6801 Sep 8 23:00 laravel-2025-09-08.log
-rwxrwxrwx 1 root root 574 Sep 9 14:54 laravel-2025-09-09.log
-rw-r--r-- 1 root root 149 Sep 10 07:25 laravel-2025-09-10.log
Note, this one is created by the supervisor:
-rw-r--r-- 1 root root 149 Sep 10 07:25 laravel-2025-09-10.log