File: rotating_logs

package info (click to toggle)
e2guardian 5.5.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,352 kB
  • sloc: cpp: 26,398; makefile: 640; sh: 324; perl: 55
file content (20 lines) | stat: -rw-r--r-- 780 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Rotating Logs - new in v5.5

A new -t option for e2guardian will now rotate the logs (access, request and dstat).

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.

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 ).

The logname.old should be moved by the calling script as any further rotate call will fail if the 
.old file is still present.

So script logic is:-

cd $LOGDIR
e2guardian -t
sleep 320   // wait for next dstats entry - can be over 5 mins
mv access.log.old $LOGSTOREDIR  // or gzip etc
mv dstats.log.old $LOGSTOREDIR