Forum

logrotate postrotate assumes hiawatha is running

ml
28 May 2017, 11:17
Hi Hugo,

the logrotate file assumes that hiawatha is running when the log is rotated.
	postrotate
/usr/bin/killall -HUP hiawatha
endscript


killall returns code 1 and therefore the logrotate executable also exits with an error.
With systemd the logrotate.service is marked as failed, which is very annoying to see. ( my opinion )

My quick & dirty solution was this:
	postrotate
/usr/bin/pidof hiawatha > /dev/null && /usr/bin/killall -HUP hiawatha
endscript


You know what I'm on to and you'll probably find a much better solution for this.

Thanks for your time,
ml
Joe Schmoe
30 May 2017, 20:08
I'm also running systemd on Debian. This is my logrotate file which uses the 'copytruncate' command so it doesn't even try to send a kill signal to the hiawatha process. Not sure if this is the best way or not but it works for me.

However, there is a note on the man page so this may not be the best for your environment:

Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost.

/var/log/hiawatha/*.log {
rotate 52
weekly
compress
copytruncate
missingok
notifempty
}
Hugo Leisink
4 June 2017, 13:43
Thanks for your feedback. There are many Unix clones and distro's, each requiring their own details in the logrotate script. Many people have sent me logrotate script updates. I appreciate that you sent me your script, but I'm not going to change the default that ships with Hiawatha. No matter what I changes I make, there will always be some one or some system requiring a change. Hope you understand.
This topic has been closed.