HTTP Anti-Virus Proxy
http://havp.hege.li/forum/

HAVP & log rotation
http://havp.hege.li/forum/viewtopic.php?f=3&t=167
Page 1 of 1

Author:  Osiris X [ 25 Sep 2006 10:13 ]
Post subject:  HAVP & log rotation

Every morning, at approximately the same time, HAVP dies with no error messages.

This event appears to coincide with log rotation - i.e. as soon as I realise it has died I go to check havp.log and it is blank and recent entries are in havp.log.1.gz.

Does HAVP handle its own log rotation?

If log rotation is being handled by my Debian system, would the closing / renaming / etc of the log file cause HAVP to crash?
(hopefully this is a case of just needing to do a controlled log rotation with daemon restart)

Thanks in advance for your help.

Os

Author:  hege [ 25 Sep 2006 14:50 ]
Post subject: 

I guess you are using debian package if rotation is done? Havp itself doesn't do it.

Version 0.82 can do log rotation. When you send HUP signal, it reopens the files. Though you should not compress the old ones right away (logrotate has delaycompress option), as it could take a little time for old processes to stop writing there.

In any case, I tested and HAVP doesn't crash here if you move and compress the current logfiles.

Cheers,
Henrik

Author:  Osiris X [ 15 Oct 2006 12:28 ]
Post subject:  HAVP & log rotation

Sending the HUP signal does not appear to work in the debian maintained version of HAVP. In fact the "reload" function is commented out in the init.d script.

#reload)
#
# If the daemon can reload its config files on the fly
# for example by sending it SIGHUP, do it here.
#
# If the daemon responds to changes in its config file
# directly anyway, make this a do-nothing entry.
#
# echo "Reloading $DESC configuration files."
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
# /var/run/$NAME.pid --exec $DAEMON
#;;

I have changed the debian logrotate script so that it restarts havp after logrotation by adding

postrotate
invoke-rc.d havp restart
endscript

While generally this works, it recently failed with the following error:

Restarting havp: Starting HAVP Version: 0.82
Could not create server (already running?)
Exiting..
invoke-rc.d: initscript havp, action "restart" failed.
error: error running shared postrotate script for /var/log/havp/access.log /var/log/havp/havp.log
run-parts: /etc/cron.daily/logrotate exited with return code 1

Any ideas on how I could prevent the restart from failing would be greatly appreciated - (perhaps I need to set a pause between starting and stopping the havp daemon, or maybe the init.d script needs to be modified to wait until the havp daemon has completely been killed before starting a new one)

Os

Author:  hege [ 15 Oct 2006 12:48 ]
Post subject:  Re: HAVP & log rotation

Osiris X wrote:
Sending the HUP signal does not appear to work in the debian maintained version of HAVP. In fact the "reload" function is commented out in the init.d script.


Why don't you just do:

postrotate
killall -HUP havp
endscript

HUP signal does work. If reload is commented out in init-script, then don't use it (the script). :)

Cheers,
Henrik

Page 1 of 1 All times are UTC + 2 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/