Debian Codegraph @

notes/rotating_logs

raw
1 Rotating Logs - new in v5.5
2
3 A new -t option for e2guardian will now rotate the logs (access, request and dstat).
4
5 The existing log will be linked to logname.old. If this is successful then the existing logfilename will be unlinked, the log file closed and then reopened.
6
7 Note that in order to avoid any thread conflict this is performed at the next entry to be output to the log. It can be a period of time before this occured ( 5 mins or more for dstat ).
8
9 The logname.old should be moved by the calling script as any further rotate call will fail if the
10 .old file is still present.
11
12 So script logic is:-
13
14 cd $LOGDIR
15 e2guardian -t
16 sleep 320 // wait for next dstats entry - can be over 5 mins
17 mv access.log.old $LOGSTOREDIR // or gzip etc
18 mv dstats.log.old $LOGSTOREDIR
19
20