0

I am trying to make a configuration file for rotation in /etc/logrotate.d/ I did this:

 sudo cat > service
 /var/log/service/service.log {
 rotate 6
 compress
 size=120M
 missingok
 create 0777 root root
 notifempty
 }

I want to add message after rotation with current date and time, some text (for e.g "Complete") in file /var/log/logrotate.log . How can I do this?

1 Answer 1

2

Add a postrotate command before the final } eg:

postrotate
 exec >> /var/log/logrotate.log
 date; echo 'completed'
endscript

This part is only executed (by /bin/sh) if the log file is actually rotated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .