editing log files at post

bishop bishop at platypus.bc.ca
Sun Sep 5 05:13:05 UTC 2010


At the list of adding more trash to the fire..

Jason's comment below, I think is excellent -- that while sed-i will 
edit the file effectively, adding the snippet into the .d tree should 
accomplish the same thing.  With an added bonus:

That second option allows the .conf file to remain unchanged, which has 
value in updates where the package being replaced has a 
%config(noreplace) and a bug fix which *addresses* the config.  I run 
into people on both ends of the packaging process who haven't grokked 
that yet, so I thought to draw attention.

  - bish

Jason Kohles wrote:
> Yes, order is important, as the options will only affect logfiles that
> come after them, and since most of your logfiles are defined in
> logrotate.d, the compress option comes too late.
>
> To uncomment the existing compress option with sed, just use:
>
> sed -i 's/^#compress/compress/' /etc/logrotate.conf
>
> An easier (and more reliable) technique, however, is to add your option
> overrides to a file that gets included before any of the other included
> files, like so:
>
> echo "compress" >> /etc/logrotate.d/000-local-overrides
>
> That way you don't have to worry about figuring out whether the
> commented out option is in the config file or what to do if someone has
> added a space after the comment character.




More information about the Kickstart-list mailing list