Re: [Mondo-devel] Any way to change log file?
Brought to you by:
bcornec
From: Mike B. <mb...@bu...> - 2008-08-25 18:19:58
|
> On Mon, Aug 25, 2008 at 11:56:22AM -0400, Woo...@ta... > wrote: >> Hello, >> >> Is there any way to change the log file, such as add a timestamp, since >> Mondo overwrites its log file every day? We have many problems with >> mondo, >> and I can't troubleshoot them because often one mondo process hangs for >> a >> day, then the next mondo process starts, and overwrites the previous >> logfile. > > Guessing that you have a cron job running mondoarchive... > You could "rotate" the previous log(s) with something like this > example on a Red Hat/Fedora system -- replace the 'mondoarchive' > command in the cron job with a small script: > > FILE: /root/run.mondo ------------------------------------------------ > #!/bin/bash > > # Save existing log files with extension derived from Day Of Week when > # the file was created > cd /var/log # Go to where the logs are > LOGS="mindi.log mondo-archive.log" > for l in $LOGS > do > [ -f $l ] || continue # No such file > # %u == Use Day Of Week (1==Monday .. 7==Sunday) > # -r FILENAME -- date is of the referenced file > day=$(date +"%u" -r $l) > mv -v $l $l.$day > done > cd - # Return to previous directory > > # Run mondoarchive job for today... > mondoarchive ... # YOUR parameters, etc. > > End FILE: /root/run.mondo -------------------------------------------- > > OR, if you prefer you could put the 'mondoarchive' BEFORE the log > rotation and do the logs just created. > > Of course you could make the $day be a full date/time or however you > like it. The DOW method keeps old logs from piling up -- you only > get up to 7 copies. Another option, assuming that you're running logrotate, might be to create a file in your /etc/logrotate.d directory that does a daily rotation on your mondoarchive.log file. -- Mike Burger http://www.bubbanfriends.org Visit the Dog Pound II BBS telnet://dogpound2.citadel.org or http://dogpound2.citadel.org To be notified of updates to the web site, visit: https://www.bubbanfriends.org/mailman/listinfo/site-update or send a blank email message to: sit...@bu... |