[netflow-tools] logrotation

Gijs Molenaar gijs at looze.net
Thu Sep 14 16:02:17 EST 2006

memic wrote:
> hi,
> i was wondering whats the best solution to rotate the flowd logfiles, im 
> doing it atm
> with a very simple bash script:
> # cat /usr/local/bin/flowd-logrotate.sh
> #!/bin/bash
> PID=`pgrep -f "flowd: monitor"`
> /bin/echo $PID
> DATE=`date +%Y%m%d`
> /bin/mv /var/log/flow/flowd.bin /var/log/flow/$DATE-flow.bin
> /bin/kill -HUP $PID
> with a cron like that:
> 0 0 * * * /usr/local/bin/flowd-logrotate.sh

In the man page (flowd.8) you can find this:
     flowd may be terminated by sending it a SIGTERM signal.  Upon 
receipt of a SIGUSR1 flowd will close and reopen its logfile.  This is 
useful for
     rotating logs.  When flowd receives a SIGHUP it will re-read its 
configuration and re-open its logfile.  Some basic runtime statistics 
will be
     logged when flowd is signalled with SIGUSR2 or SIGINFO.

Sending the HUP signal will work, but maybe some flows are lost (not 
sure). The best thing is to replace HUP with SIGUSR1.



More information about the netflow-tools mailing list