Operating System - HP-UX
1833825 Members
1976 Online
110063 Solutions
New Discussion

Re: Can log files be looped at whatever size we specify ?

 
SOLVED
Go to solution
Amith_2
Frequent Advisor

Can log files be looped at whatever size we specify ?


Hello,

I have an application which will write to a log file while processing.

I would like to know , if there is any setting or environment variable whcih will recreate the file when it hits 1 GB and then start logging activity from where its stopped.

Please tell me whether i need to handle this in the program itself.
3 REPLIES 3
Peter Godron
Honored Contributor

Re: Can log files be looped at whatever size we specify ?

Amith,
I don't think you can move a file opened by an application without causing the application to crash, unless the application was written that way !

Normally the application is stopped and then restarted.

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.

You profiles indicates you have only rewarded 5 out of 76 answers.
Bill Hassell
Honored Contributor
Solution

Re: Can log files be looped at whatever size we specify ?

There is nothing to 'cleanup' logfiles in the OS. The main reason is that many logfiles need scanning and summarizing before being retired. Or more commonly in today's security environment, logfiles must be archived, typically in a compressed format.

I would add some simple code in your application to perform the logfile loop. Be sure that you can afford to lose 100% of the old data. Most logfiles are only useful if they contain some amount of history. By restarting with a new logfile, all the previous data is gone. Might be useful to alternate between logfileA and logfileB and set a smaller size limit. That way a lot of history is always available from the previous file.


Bill Hassell, sysadmin
Amith_2
Frequent Advisor

Re: Can log files be looped at whatever size we specify ?

Thanks to both of you...

I will reward the answers from here on without any delay.

Sorry for that.