Re: Fwd: suggestion to handle stock Fedora 8 logrotate changed extension on archived log files
MrC <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
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?
>