How to stop logrotate from changing the rotated logs owner
I use the create directive in my /etc/logrotate.d/ files. Example: create 0664 www-data www-data
I use the create directive in my /etc/logrotate.d/ files. Example: create 0664 www-data www-data
How do you know the file is not getting rotated? On a Debian 6 Linode I have, in the default configuration logrotate was only scheduled by cron to run once per day, and at a very odd time at that. If only run once per day, naturally it’ll only have one opportunity per day to … Read more
I’m not aware of any variables you can use if that’s what you’re looking for. However immediately after rotating the log, you should know precisely the name that the file has been rotated to based on the configuration you’ve set for the rotation (/var/log/somefile.1 or the like). Perhaps it would be easier to answer if … Read more
I think that weekly means that logrotate wants to see at least a week old entry for your access.log file in order to rotate it. Hence the problem seems to be that you are not storing the state entry to trigger the rotation. Here is a stepped through example of the simple of case, of … Read more
A common issue is when you first setup a daily logrotate.d entry, it will not rotate the first day. When you use a time based rotation (daily/weekly/monthly) logrotate scribbles a date stamp of the last date it saw the file in /var/lib/logrotate/status (or /var/lib/logrotate.status on RHEL systems). The scribbled date becomes the reference date from … Read more
logrotate does not log anything by default. normally it should be in your cron somewhere, for instance: $ grep -r — ‘logrotate.conf’ /etc/cron* /etc/cron.daily/logrotate:/usr/sbin/logrotate /etc/logrotate.conf You can either run that manually to see what is wrong, or redirect the logrotate output to a file in the above cron to see what happened next day. Likely … Read more
Your understanding of copytruncate is correct, but the wording in the manpage for delaycompress is a little misleading. More properly, it should say “when some program cannot be told to immediately close it’s logfile” — for instance, if you’re using sharedscripts and the script sends a signal to the process using the log when all … Read more
If the size directive is used, logrotate will ignore the daily, weekly, monthly, and yearly directives. This is not clear in the documentation when you execute the man logrotate command. However it can be confirmed in practice, and is mentioned in some arbitrary blog posts such as this one. There is a directive called minsize … Read more
How deep do your subdirectories go? /var/log/basedir/*.log /var/log/basedir/*/*.log { daily rotate 5 } Will rotate all .log files in basedir/ as well as all .log files in any direct child of basedir. If you also need to go 1 level deeper just add another /var/log/basedir/*/*/*.log until you have each level covered. This can be tested … Read more