Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Extract new lines from log file

by ferreira (Chaplain)
on Jan 02, 2007 at 20:00 UTC ( [id://592624]=note: print w/replies, xml ) Need Help??


in reply to Extract new lines from log file

Is there a better way to periodically extract the new lines from a log file?

I did it once and the algorithm was very similar to the one you described. The only thing that changed was that instead of saving the line count, I save the return of tell (that is, the offset of the file at the last read). This way, when you decide the file has changed and read the offset where you stopped, you just seek and go on from that place. I think you're gonna be quite pleased with the performance after this straightforward change.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found