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

Re: How do I read a log file that contents recurring log messages those are separated by newline characters?

by pileofrogs (Priest)
on Oct 14, 2010 at 19:16 UTC ( #865336=note: print w/ replies, xml ) Need Help??


in reply to How do I read a log file that contents recurring log messages those are separated by newline characters?

This is what perl is great for.

Probably the most direct approach would be to parse each line with a regex to get the parts you care about (IE not the timestamp). Create a hash where the key is the relevant part of the line and the value is a number that you increment every time you find the same message. Notice you're not keeping the whole file in memory, just one instance of each line and a number.

--Pileofrogs


Comment on Re: How do I read a log file that contents recurring log messages those are separated by newline characters?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-04-20 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls