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]>
On Apr 30, 2008, at 9:57 AM, Mike Tremaine wrote:

> MrC wrote:
>>> ---------- Forwarded message ----------
>>> From: Damon Hart
>>> Date: Mon, Feb 11, 2008 at 5:44 AM
>>> Subject: suggestion to handle stock Fedora 8 logrotate changed
>>> extension on archived log files
>>> To: [email protected]
>>>
>>>
>>> Following up on some items I found missing in my logwatch daily  
>>> recap
>>>  email, I see that events occurring prior to log rotation were not
>>>  reflected in logwatch. Comparing different machines, it looks  
>>> like this
>>>  problem occurs (in my case) only on Fedora 8 (vs earlier Fedora
>>>  revisions.) Further poking around suggests that the problem arises
>>>  because of the stock Fedora 8 logrotate convention for naming  
>>> archived
>>>  log files. These filenames are now:
>>>
>>>  messages.20080210
>>>  messages.20080203
>>>  messages.20080127
>>>  messages.20080120
>>>
>>>  instead of the prior convention:
>>>
>>>  messages.1
>>>  messages.2
>>>  messages.3
>>>  messages.4
>>>
>
> On my fedora 8 is is - not .
>
>> [mgt@dwarfstar ~]$ ls -al /var/log/messages*
>> -rw------- 1 root root    212 2008-04-30 08:30 /var/log/messages
>> -rw------- 1 root root 574792 2008-04-07 08:39 /var/log/ 
>> messages-20080407
>> -rw------- 1 root root 338783 2008-04-14 07:47 /var/log/ 
>> messages-20080414
>> -rw------- 1 root root 623934 2008-04-21 08:20 /var/log/ 
>> messages-20080421
>> -rw------- 1 root root 804230 2008-04-30 07:02 /var/log/ 
>> messages-20080430
>
>
>>
>>     @TempLogFileList = sort{
>>          ($b =~ /\.(\d+)$/)[0] <=> ($a =~ /\.(\d+)$/)[0]
>>               ||
>>           uc($a) cmp  uc($b)
>>       }(glob($dir . $ReadConfigValues[$i]));
>>
>>
>
>

This seems to work

                        @TempLogFileList = sort{
                            ($b =~ /(\d+)$/) <=> ($a =~ /(\d+)$/) ||  
uc($a) cmp  uc($b)
                         }(glob($dir . $ReadConfigValues[$i]));

The other problem would be in conf/logfiles/maillog since the Archive  
list would be .\d+ rather then -\d+ .. I'll play around with it more  
to try and reach a happy medium.

-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.