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

You are including the time stamps in the key, so identical events a second apart increment separate counts. or maybe you were showing the overall concept, and leaving the trimming as an exercise for the student?

It looks like gen-vcs11 kernel is a standard component of every line, so I would ignore it. Using split to extract the second and third components, and using those as a key:

my ( $code, $msg ) = ( split, ':', $_)[2,3]; $msgs{$code}{$msg}++;

It becomes even simplar if you only want to preserve the msg component.

As Occam said: Entia non sunt multiplicanda praeter necessitatem.

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

Replies are listed 'Best First'.
Re^3: How do I read a log file that contents recurring log messages those are separated by newline characters?
by toolic (Bishop) on Oct 15, 2010 at 15:51 UTC
    or maybe you were showing the overall concept, and leaving the trimming as an exercise for the student?
    Yes.