Operating System - HP-UX
1753797 Members
7378 Online
108805 Solutions
New Discussion юеВ

Reduce the logfile size and logfile encapsulator

 
koff
Frequent Advisor

Reduce the logfile size and logfile encapsulator

hello!
I created a logFile template to report in a message browser ERROR messages.
Then, I created a template to monitor this logfile (on NT boxes). When this file is bigger than n bytes, I reduce its size, I saved only last 100 lines on this file.
After this automatic action, my logfile template report last ERROR msg as if new error messages while they are old messages...
What must i do to not report these old messages? I must save the last 100 lines in my log file...
Any idea ?
Thank you vry much to help me...
3 REPLIES 3
G. Vrijhoeven
Honored Contributor

Re: Reduce the logfile size and logfile encapsulator

Hi,


Stop logging.
tail -100 logfile >> logfile.new
mv logfile.new logfile
Start logging.

HTH,

Gideon
Robert-Jan Goossens
Honored Contributor

Re: Reduce the logfile size and logfile encapsulator

Hi,

Use a tool like logrotate.

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-2.5/

But I'm not shore where to find something like this for NT.

Regards,
Robert-Jan
David Burgess
Esteemed Contributor

Re: Reduce the logfile size and logfile encapsulator

From a unix point of view grab a copy of cygwin from www.cygwin.com

Then stop logging

#tail -100 logfile > temp_logfile
#mv temp_logfile logfile

finally start logging

HTH

Regards,

Dave.