Logrotating single-issue files
Harry Putnam
reader at newsguy.com
Mon Nov 10 15:36:27 UTC 2003
Jos Vos <jos at xos.nl> writes:
> if [ -s $1 ]; then
> gzip $1
> else
> mv $1 $1.gz
> fi
Will something like this work? The scripting below in /etc/logrotate
would: Put all the lines from each trace.*, prefaced by filename in
BIGTRACE.file. Then it deletes the trace* files.
The next log entry checks BIGTRACE.file for size then rotates and
compresses if necessary. You can test it by creating the files and dirs
then placing this code in some.file and running: `logrotate -v
some.file'
/home/reader/t/var/test/trace.* {
size=2
nocreate
rotate 2
firstaction
awk '{print FILENAME,$0}' /home/reader/t/var/test/trace* >> /home/reader/t/va
r/test/BIGTRACE.file
endscript
lastaction
rm -f /home/reader/t/var/test/trace*
endscript
}
/home/reader/t/var/test/BIGTRACE.file {
nocreate
rotate 2
compress
size=500k
}
More information about the fedora-devel-list
mailing list