[clug] rotating log files
Robert Edwards
bob at cs.anu.edu.au
Fri Mar 23 02:10:48 GMT 2007
Hi Michael,
Good point, hadn't thought of using the pre/post rotate hooks to
override what logrotate might otherwise be configured to do.
I'll look into that.
Cheers,
Bob Edwards.
Michael Cohen wrote:
> Bob,
> logrotate has a prerotate/postrotate hook for putting in shell commands, you
> could easily rename the log file there. As little hint, dont use a time stamp
> with the : character in it (as you get for example from `date`) because
> although all unix filesystems do support any character in a file name (except
> /), all windows filesystems have weird limitations on characters in a
> filename and ':' is definitely not allowed. This was very puzzling to me the
> first time I tried to copy timestamped log files to a usb drive for example.
>
> Michael.
>
> On Fri, Mar 23, 2007 at 10:22:17AM +1100, Robert Edwards wrote:
>> 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.
>> --
>> linux mailing list
>> linux at lists.samba.org
>> https://lists.samba.org/mailman/listinfo/linux
More information about the linux
mailing list