[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Logrotating single-issue files



Jos Vos <jos 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
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]