So i have a log at ubuntu server that i implemented logrotate to rotate the log, but i notice one things that the number is too big and i dont understand how to read the number beside the log
Any help on this? or any explanation to how to read it "52548376" or what does it stand for
here is my configuration for logrotate:
/var/log/mongodb/*.log{
rotate 7
daily
size 100M
missingok
create 0600 mongodb mongodb
delaycompress
compress
sharedscripts
postrotate
/bin/kill -SIGUSR1 $(pgrep -f mongod)
endscript
}
i notice that it should rotate the log after it reached 100MB
That's the file size in Bytes.
52548376 Bytes are 52MByte but you set a limit of 100MByte, so why do you expect a log rotation?
Instead of kill -SIGUSR1 $(pgrep -f mongod)
I would suggest
kill -SIGUSR1 $( /usr/sbin/pidof mongod )
or even better
if /usr/sbin/pidof -s mongod > /dev/null ; then kill -USR1 $( /usr/sbin/pidof mongod ) ; fi
You specified daily
which means the logfile is rotated daily, no matter whether the size reached 100MB or not. Using daily
and size
makes only sense if you run logrotate
more than once a day.
Option create
is not needed. mongod creates a new logfile automatically. Instead I would add notifempty