[logs] How do you cull through serial console logs?

Michael Kinsley michael.kinsley at sensage.com
Fri Mar 7 20:51:40 PST 2008


You can use perl's IO::Multiplex module to watch all those files with  
non-blocking IO.

Courtesy of the Perl Cookbook and a little extra map{} from me:

use IO::Multiplex;

my $regex_array = [
	qr/Pattern1/,
	qr/Pattern2/,
	qr/Pattern..n/

];

$mux = IO::Multiplex->new( );
$mux->add($FH1);
$mux->add($FH2); # ... and so on for all the filehandles to manage
$mux->set_callback_object(_ _PACKAGE_ _);  # or an object
$mux->Loop( );

sub mux_input {
   my ($package, $mux, $fh, $input) = @_;

   map { $line =~ m/$_/ and print "Matched Line of Interest: $line  
\n" } @{$regex_array};
}


Michael Kinsley

Consulting Engineer

SenSage, Inc.
55 Hawthorne Street Ste. 700
San Francisco, CA 94105 USA

email:     michael.kinsley at sensage.com
mobile:  +1.415.465.0106
fax:         +1.415.371.1385



On Mar 7, 2008, at 1:38 PM, Zonker Harris wrote:

> I'm using Conserver, which makes reverse-TCP connections to console  
> server serial ports, so I can manage my hosts and net gear. This  
> results in an ASCII text file for each device.
>
> What tool(s) can I use to watch all (500+) files for 'interesting'  
> strings, like malloc errors, failed logins, net connection/port/ 
> link failures?
>
> I've found log watcher, but it is a one- file-at-a-time deal. I'd  
> rather not reinvent the wheel if there is a good answer out there.  
> I'm hoping to get to RSA con this year, and perhaps find other  
> pointers to share.
>
> Thank you for any tips,
>
>           =Z=
>
> http://www.conserved.com/consoles/
> http://consoleteam.blogspot.com/
>
> _______________________________________________
> LogAnalysis mailing list
> LogAnalysis at loganalysis.org
> http://www.loganalysis.org/mailman/listinfo/loganalysis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.loganalysis.org/pipermail/loganalysis/attachments/20080307/56ef0e18/attachment.html


More information about the LogAnalysis mailing list