[clug] rotating log files

Robert Edwards bob at cs.anu.edu.au
Thu Mar 22 23:22:17 GMT 2007


Can anyone suggest to me why rotating log files would ever be
considered a "Good Idea"?

Most distros come with a utility "logrotate" configured to
rename a whole bunch of log files each day/week/month (configurable).

To me, a much better approach would be to date-stamp each of the
log files each day/week/month (configurable) and not to rotate the
file names.

Does such an alternative exist (before we write our own)? What should
I search for?

Why do I care? Our backup server makes archive copies of each file
that is deleted or modified. In the case of rotating log files, each
log file gets archived each day/week/month as its name is changed.
We really only need/want one copy of the log file in the archive.

Also, determining which log file is relevant for, say, last Tuesday
means counting backwards in the case of rotating log files, but in
the case of date-stamped log files, is simply a matter of looking in
the file with the relevant date stamp (maybe the date stamp for the
day after).

Just wondering out loud, before sitting down to some coding.

Bob Edwards.


More information about the linux mailing list