Webstack - logrotate
The nginx log files are managed via a config file in /etc/logrotate.d/nginx with the defaults being overriden in /etc/logrotate.conf which currently does not exist so the default settings are used. The logrotate.d files add application specific settings. The second level log folders have been added to the list along with the php-fpm.log file.
/var/log/nginx/*.log /var/log/nginx/garage-press/*.log /var/log/nginx/graham-ovenden/*.log /var/log/nginx/lsces/*.log /var/log/nginx/medw/*.log /var/log/nginx/myhomecloud/*.log /var/log/nginx/phpsurgery/*.log /var/log/nginx/rainbowdigitalmedia/*.log /var/log/nginx/timedb/*.log /var/log/php-fpm.log { su nginx nginx compress dateext maxage 365 rotate 99 size=+8192k missingok notifempty delaycompress lastaction # "-s reopen" will use the pid file passed in the config file or the compiled in default path [ -f /run/nginx.pid ] && /usr/sbin/nginx -s reopen endscript }
What it would be nice to do is to create a temporary copy of the old log along with the new one for the stats report page so that it does not go blank when the log files are rotated. I'm slowly getting all of this under control.
On openSUSE, logrotate
automatically handles log file compression, rotation, and removal, typically via a systemd timer
that runs daily. You can configure its behavior by editing the main /etc/logrotate.conf
file for global settings or by creating specific configuration files in the /etc/logrotate.d/
directory for individual log files, with settings like rotation frequency, number of old logs to keep, and date extensions.
How logrotate works
- Automatic Rotation:
logrotate
runs on a schedule (usually daily) and rotates, compresses, and removes log files that grow too large. - Configuration Files:
/etc/logrotate.conf
: Contains global default settings and includes configurations for specific services./etc/logrotate.d/
: This directory holds individual configuration files for specific log files, such as those for web servers or applications.
- Systemd Integration: A
logrotate.timer
service manages the scheduled execution oflogrotate
.