Bug: php_log log rotation is broken in latests versions

SYSTEM INFORMATION
OS type and version Ubuntu 20.04
Webmin version 2.021
Virtualmin version 7.7

Virtualmin Validation on new servers created after ~2023? I got 150 domains and 10 of those are invalid.
There is no php_log file in this folder nor a link to /var/logs/virtualmin folder.

Log file rotation : No logrotate configuration found for file /home/xxxx/domains/yyyy.com/logs/php_log

1 Like

I don’t think Virtualmin sets up php_log, by default? Don’t PHP errors log to the error_log, by default? If that’s the case, Virtualmin wouldn’t setup log rotation for a log it doesn’t configure into existence (it does setup rotation for the logs it configures, including the Apache error_log and access_log for each domain).

1 Like

I’ve never set logging for php and it has set logs for php into the home dir of the virtual servers. Then we have to setup rotations manually or disable. Can’t see the point of them being on unless needed.
template is on

1 Like

Ah, I guess FPM does log separately in a default configuration, and that means we should be setting up rotation.

But, weirdly, I’m looking at one of my systems, and rotation does seem to be happening. I’m not sure where, though…I definitely didn’t set it up, but it’s possibly something Ilia set up. I’m looking into it.

2 Likes

Also No logrotate configuration found for file php_log from a couple of days ago.
Same issue.

1 Like

I have the same issue in all domains. Any ideas to solve this bug or fix this error ??
In both Servers Ubuntu 22.04 and Almalinux 8 with Virtualmin 7.7

Any update on this one?

This happens because we don’t actually create a log file when setting up PHP logging. This file is used by PHP to write potential errors, therefore on most systems that file won’t exist on its own. We don’t expect that to be a problem for logrotate itself, however Virtualmin validate_logrotate is going to complain.

The solution to this problem is just to create an expect PHP log file when settings things up. I can take a look at this.

@Jamie, also I just discovered that 1. logrotation is not getting set up at all with Nginx, and that 2. with Nginx php_log is not set correctly (not set at all) on domain creation time, even though it’s enabled in the templates.

1 Like

No I think this means that there is no entry in /etc/logrotate.conf for the file /home/xxxx/domains/yyyy.com/logs/php_log , not that the log file doesn’t exist.

Any news on this one. Still have it.
Weirdly, for new domains, the correct logrotate is added.
Any trick to not manually add the log for all domains without the correct logrotate?

Yes, upcoming Virtualmin release will create an empty PHP log file upon PHP log setup.

@Jamie, although this is still an evident problem with Virtualmin Nginx module.

This commit should fix the issue of the PHP log not being created : Make sure the PHP log file exists so logrotate doesn't choke https://… · virtualmin/virtualmin-gpl@25c9dc0 · GitHub

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.

I created separate tickets for that:

1 Like