Hi Til,
whats the sense of the logging in var/log/xml/time/....?
That fills gigabyte over the time. Can that be turned off?
I use the following shell script fragment to move logs that are older
than x days to an archive. If you call this daily with a different
name you will get a nice archive of tar.gz files that contain the
logs for the moment you need them.
Use at your own risk, of course.
cheers
Martin
#!/bin/bash
...
# custom settings
OPENCA_HOME=/usr/local/openca-0.9.2
# keep xml log files no older than KEEPDAYS (in days)
KEEPDAYS=7
LOGGER=/bin/logger
FIND=/usr/bin/find
TAR=/bin/tar
DATE=/bin/date
RM=/bin/rm
WC=/usr/bin/wc
XARGS=/usr/bin/xargs
...
# archive log files
openca_archive_logs() {
if [ -e "$1" ] ; then
logger "Archive $1 already exists"
exit 1
fi
# write all files/links older than n days to the specified
archive
# directory and remove the archived files
( cd $OPENCA_HOME && \
$FIND var/log/ \
\( -type l -o -type f \) \
-name \*.xml -mtime +$KEEPDAYS | \
$TAR czvf "$1" --files-from - 2>/dev/null | \
$XARGS $RM -f \
)
# purge empty log directories:
# for each directory below log/xml/time that has zero real
files
# or symlinks below it remove the directory hierarchy below
( cd $OPENCA_HOME && \
for i in `$FIND var/log/xml/time -type d -maxdepth 3
2>/dev/null` ; do
if [ -d "$i" -a `$FIND "$i" -type f -o -type
l 2>/dev/null | $WC -l` = 0 ] ; then
$RM -rf "$i"
fi
done
)
}
...
logger "Archiving log files"
INDEX=0
ARCHIVE=/var/log/`$DATE -I`-$INDEX-openca-xml-log.tar.gz
while [ -e "$ARCHIVE" ] ; do
INDEX=$(( $INDEX + 1))
ARCHIVE=/var/log/`$DATE -I`-$INDEX-openca-log.tar.gz
done
openca_archive_logs $ARCHIVE
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
OpenCA-Devel mailing list
OpenCA-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openca-devel