# augeas and logrotate, add a postrate instead of replacing the existing one

Hi Folks,

I'm trying to manage the /etc/logrotate.d/syslog file using augeas (then puppet)

So first i'm trying to do that using augtool. basically, my goal is to add a postrotate rule in the "postrotate" section linked to /var/log/messages, whatever where is located this section and if a rule already exist .

during my test I was able to create a postrotate rule, but it replace the existing one. How can we simply add a postrotate and not replace the existing one?

For the moment I was able to replace any existing postrotate line with a single "test" word, by doing that:

set /files/etc/logrotate.d/syslog/rule[file='/var/log/messages']/postrotate test


the result is

    postrotate
test
endscript


But again, my goal is to append the postrotate, not replace the existing one. Currently there is a postrotate like that:

postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript


my goal is to have something like that using augeas:

postrotate
invoke-rc.d rsyslog rotate > /dev/null
test
endscript