Ok, I have Googled this and either I am not asking the right way or I just
can't see what's in front of me (sorry)...
We have log files called app.2011-10-119.log (with the date changing every
day). The log is created by the application each day at midnight.
I have logrotate set to rotate files ending in .log at 4am, with
copytruncate on by default.
If I list the files I see all the old app.2011-10-<X>.log files with a 0
file size.
If I turn off copytruncate, the current days log file will be removed
everyday at 4am.
How can I satisfy both the need to remove yesterday's log file while keeping
the current day?
Here is the logrotate file:
/var/log/app/*.log {
daily
rotate 10
compress
missingok
notifempty
create 0644 user user
}
I added notifempty to keep the old empty log files from being compressed...
Thanks,
John
John Kennedy