I find it useful to parse the log file(s) with sed
. Then I can report without all the noise but keep the original file (for a little while) in case I need to chase an issue.
Here’s the relevant bit of the script:
# now some logfile maintenance ($LOGFILE is the file we've been piping all output into)
cd /home/brian/duplicacy/logs
# roll the summary logs over
mv "daily-duplicacy-5.log.gz" "daily-duplicacy-6.log.gz"
mv "daily-duplicacy-4.log.gz" "daily-duplicacy-5.log.gz"
mv "daily-duplicacy-3.log.gz" "daily-duplicacy-4.log.gz"
mv "daily-duplicacy-2.log.gz" "daily-duplicacy-3.log.gz"
gzip "daily-duplicacy-1.log"
mv "daily-duplicacy-1.log.gz" "daily-duplicacy-2.log.gz"
mv "daily-duplicacy.log" "daily-duplicacy-1.log"
# summarise the latest
sed -f /home/brian/duplicacy/bin/summary.sed $LOGFILE > daily-duplicacy.log
# and keep long-term brief summary
sed -f /home/brian/duplicacy/bin/brief.sed daily-duplicacy.log >> daily-duplicacy-long-term.log
# keep the entire log till next time
mv $LOGFILE daily-duplicacy-full.log
The two sed
command files are:
summary.sed
:
/\ DEBUG\ /d ; /\ TRACE\ /d ; /INFO\ UPLOAD_PROGRESS/d ; /INFO\ PACK_END/d ; /INFO\ SNAPSHOT_EXIST/d ; /\ skipped\ at\ the\ destination/d
and brief.sed
:
/INFO\ UPLOAD_FILE/d ; /INFO\ CONFIG_INFO/d ; /INFO\ BACKUP_INDEXING/d ; /INFO\ SNAPSHOT_FILTER/d ; /WARN\ SKIP_DIRECTORY/d ; /WARN\ SKIP_FILE/d ; /INFO\ SNAPSHOT_COPY\ Chunk/d
Brian