Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to read from rotated log file?

by johngg (Abbot)
on Jan 29, 2012 at 23:47 UTC ( #950672=note: print w/ replies, xml ) Need Help??


in reply to How to read from rotated log file?

If you know the date you want to go back to then you should be able to convert that date into epoch seconds (see Time::Local) and compare with the time last modified (see stat) of your compressed log files to see which one to examine.

If you are using 5.12 or later you should be able to use the built-in IO::Uncompress::Bunzip2 module to read the file. 5.10 or earlier and you will have to use the bunzip2 executable the way JavaFan has shown for gunzip.

Cheers,

JohnGG


Comment on Re: How to read from rotated log file?
Re^2: How to read from rotated log file?
by Wen (Initiate) on Feb 02, 2012 at 05:40 UTC
    Thank you, JohnGG. It is a great idea to look at the file creation dates and I used the piece of code by JavaFan with slight modifications. Thanks for your help, guys!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950672]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-09-30 18:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (381 votes), past polls