Hello,
I have a Syslog-NG server write to some log files and a program (SEC) reading from them. The SEC needs to have the same file opened, so I was using the copytruncate in the logrotate of the log files. My problem is that I'm losing some log entries during the rotation.
Here's my logrotate configuration file:
Code:
/srv/syslog/pulso/*.log {
rotate 2
copytruncate
compress
ifempty
missingok
lastaction
find /srv/syslog/pulso/*.log.{1,2}.gz 2>/dev/null |while read f; do
DATA=`date +%Y-%m-%d`
HORA=`date +%H`
HORA=`expr $HORA - 1`
[ "$HORA" == "-1" ] && HORA=23
HORA=`printf "%02d" $HORA`
new_filename=`echo $f |sed 's/\.[12]\.gz//'`
mv $f $new_filename.${DATA}_${HORA}.gz
done
endscript
}
There's any alternative to copytruncate without losing events? The lastaction that I have, could slow down the process?
Thanks.