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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.