Re: Fwd: suggestion to handle stock Fedora 8 logrotate changed extension on archived log files

Mike Tremaine <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
MrC wrote:
> Bjorn L. wrote:
>> Would this work?
>>
>>       @TempLogFileList = sort{
>>          (stat($a))[9] <=> (stat($b))[9];
>>         }(glob($dir . $ReadConfigValues[$i]));
>>
>> where stat returns an array, the ninth index of which is the modified time.
> 
> 
> 
> I considered stat as well.  As long as file timestamps are correct this 
> works fine (and generally this is the case, esp. for automated, standard 
> rotations).  For any log data that is archived, let say in bulk to 
> remote storage, mtime is not useful, and using sequence-based filenames 
> is more reliable.  (I keep log data for a long time off line, and 
> haven't worried amount the file's mtimes, and use suffixes instead).
> 
> This is one of those hidden gotchas, that has gone undetected, likely 
> aided by somewhat vague documented behavior :
> 
>    --archives
>    Each  log-file-group has basic logfiles (i.e. /var/log/messages)
>    as well as archives (i.e. /var/log/messages.?  or  /var/log/mes-
>    sages.?.gz).   When  used  with  "--range all", this option will
>    make Logwatch search through the archives  in  addition  to  the
>    regular  logfiles.   For  other values of --range, Logwatch will
>    search the appropriate archived logs.
> 
> as well as rarity of use (not many I suspect use --range all for example).
> 
>  > Then the issue of which files to sort on is left to the config file,
>  > which is currently messages.* for the "messages" logfile, or cron.*
>  > for the cron logfile.
> 
> Well, not really - the config file has no control over mtime. :-)
> 
> MrC
> 
> 
>> Also, a question:  is the new format only for archived log files, or 
>> does it also apply to the current log file?
>>


Archives is normally on by default with the purpose of catching that 
lost period between 12 -> 4AM when logs got written to file [the 
previous day] and then rotated.

But yeah this is a bit of problem...

We use mtime for the Archive process already [around line 880 on fedora 
core 8 release 739 in CVS]

       my @FileStat = stat($Archive);
       if ($CheckTime <= ($FileStat[9])) {

So if you have archived off the files and then try to use them later you 
are already out of luck.

I guess I'm not sure what to do about this, I think the mtime stat is 
probably the right thing unless we want to really rewrite this. How wide 
spread is this new rotation going to be?

-Mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.