FAQ
Hi all,

I have to modify logrotate conf file for rsyslog with augeas.
I have this configuration:

/var/log/syslog
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
postrotate
reload rsyslog >/dev/null 2>&1 || true
endscript
}

/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
{
rotate 4
weekly
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
reload rsyslog >/dev/null 2>&1 || true
endscript
}

And I want to delete all rows that contains /var/log/mail* but the path
in augeas is:

/files/etc/logrotate.d/rsyslog/rules[2]/file[1] (and go on untile file[4])

node file is an array that contains all file that should be rotated, but
if I want to delete this rows without specify the array indexes, it's
possible to do?

Thanks in advance.
Regards,
Fx

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Luke Bigum at May 8, 2012 at 8:26 am
    Theoretically you should be able to do this:

    augtool> print /files/etc/logrotate.d/syslog/rule/file[. =~
    regexp("/var/log/mail")]

    ... but I can't get the Regular Expression function to work in augtool :-(

    You could match each one, considering you know the names of each Syslog
    Level:

    augtool> print
    /files/etc/logrotate.d/syslog/rule/file[.="/var/log/mail.info"]
    /files/etc/logrotate.d/syslog/rule/file[1] = "/var/log/mail.info"
    augtool> print
    /files/etc/logrotate.d/syslog/rule/file[.="/var/log/mail.err"]
    /files/etc/logrotate.d/syslog/rule/file[3] = "/var/log/mail.err"

    ... and so on.

    HTH,

    -Luke
    On 07/05/12 17:06, Felice Pizzurro wrote:
    Hi all,

    I have to modify logrotate conf file for rsyslog with augeas.
    I have this configuration:

    /var/log/syslog
    {
    rotate 7
    daily
    missingok
    notifempty
    delaycompress
    compress
    postrotate
    reload rsyslog >/dev/null 2>&1 || true
    endscript
    }

    /var/log/mail.info
    /var/log/mail.warn
    /var/log/mail.err
    /var/log/mail.log
    /var/log/daemon.log
    /var/log/kern.log
    /var/log/auth.log
    /var/log/user.log
    /var/log/lpr.log
    /var/log/cron.log
    /var/log/debug
    /var/log/messages
    {
    rotate 4
    weekly
    missingok
    notifempty
    compress
    delaycompress
    sharedscripts
    postrotate
    reload rsyslog >/dev/null 2>&1 || true
    endscript
    }

    And I want to delete all rows that contains /var/log/mail* but the
    path in augeas is:

    /files/etc/logrotate.d/rsyslog/rules[2]/file[1] (and go on untile
    file[4])

    node file is an array that contains all file that should be rotated,
    but if I want to delete this rows without specify the array indexes,
    it's possible to do?

    Thanks in advance.
    Regards,
    Fx

    --
    Luke Bigum

    Information Systems
    Ph: +44 (0) 20 3192 2520
    [email protected] | http://www.lmax.com
    LMAX, Yellow Building, 1A Nicholas Road, London W11 4AN


    FX and CFDs are leveraged products that can result in losses exceeding
    your deposit. They are not suitable for everyone so please ensure you
    fully understand the risks involved. The information in this email is not
    directed at residents of the United States of America or any other
    jurisdiction where trading in CFDs and/or FX is restricted or prohibited
    by local laws or regulations.

    The information in this email and any attachment is confidential and is
    intended only for the named recipient(s). The email may not be disclosed
    or used by any person other than the addressee, nor may it be copied in
    any way. If you are not the intended recipient please notify the sender
    immediately and delete any copies of this message. Any unauthorised
    copying, disclosure or distribution of the material in this e-mail is
    strictly forbidden.

    LMAX operates a multilateral trading facility. Authorised and regulated
    by the Financial Services Authority (firm registration number 509778) and
    is registered in England and Wales (number 06505809).
    Our registered address is Yellow Building, 1A Nicholas Road, London, W11
    4AN.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Dominic Cleal at May 8, 2012 at 8:39 am

    On 08/05/12 09:26, Luke Bigum wrote:
    Theoretically you should be able to do this:

    augtool> print /files/etc/logrotate.d/syslog/rule/file[. =~
    regexp("/var/log/mail")]

    ... but I can't get the Regular Expression function to work in augtool :-(
    Very nearly. Try this:

    augtool> print /files/etc/logrotate.d/syslog/rule/file[. =~
    regexp("/var/log/mail.*")]
    /files/etc/logrotate.d/syslog/rule/file[3] = "/var/log/maillog"

    The regexps are anchored by default, so you need the .* to match
    anything after "mail".

    --
    Dominic Cleal
    Red Hat Consulting
    m: +44 (0)7817 878113

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Felice Pizzurro at May 8, 2012 at 9:30 am
    Thanks a lot! it works fine!

    As in rsyslog logrotate conf file there are many rules, I used this
    syntax to retrieve the correct rule instead to define rule index manually:

    augtool> print /files/etc/logrotate.d/rsyslog/rule[file =~
    regexp("/var/log/mail.*")]/file[. =~ regexp("/var/log/mail.*")]
    On 08/05/2012 10:39, Dominic Cleal wrote:
    On 08/05/12 09:26, Luke Bigum wrote:
    Theoretically you should be able to do this:

    augtool> print /files/etc/logrotate.d/syslog/rule/file[. =~
    regexp("/var/log/mail")]

    ... but I can't get the Regular Expression function to work in augtool :-(
    Very nearly. Try this:

    augtool> print /files/etc/logrotate.d/syslog/rule/file[. =~
    regexp("/var/log/mail.*")]
    /files/etc/logrotate.d/syslog/rule/file[3] = "/var/log/maillog"

    The regexps are anchored by default, so you need the .* to match
    anything after "mail".
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to [email protected].
    To unsubscribe from this group, send email to [email protected].
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMay 7, '12 at 4:06p
activeMay 8, '12 at 9:30a
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2023 Grokbase