From: rettenbe Date: Wed, 26 Mar 2008 16:20:18 +0000 (+0000) Subject: more functionality for log-parser X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cd74a990b2943a6333a3e46829d4c9889ebe8702;p=gosa.git more functionality for log-parser git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10003 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/tests/log-parser.pl b/gosa-si/tests/log-parser.pl index 6158e87f2..6b9e6c2db 100755 --- a/gosa-si/tests/log-parser.pl +++ b/gosa-si/tests/log-parser.pl @@ -23,13 +23,23 @@ use warnings; use Getopt::Long; use Data::Dumper; -my $log_file = "/var/log/gosa-si-server.log"; +my $log_file = "/home/hickert/log.gosa-si-server"; +#my $log_file = "/var/log/gosa-si-server.log"; my $within_session = 0; my $within_incoming = 0; my $within_header = 0; my $session; my $incoming; my $header; +my $syslog_state; + +sub check_syslog_state { + my ($line) = @_ ; + if($line =~ /$syslog_state:/ ) { + return $line; + } + return; +} sub check_header { my ($line) = @_ ; @@ -87,6 +97,7 @@ GetOptions( "s|session=s" => \$session, "i|incoming=s" => \$incoming, "h|header=s" => \$header, + "l|log=s" => \$syslog_state, ); # check script pram @@ -102,7 +113,11 @@ if (defined $incoming) { if (defined $header) { print "header: $header\n"; $script_pram->{'header'} = $header; -} +} +if (defined $syslog_state) { + print "syslog_state: $syslog_state\n"; + $script_pram->{'syslog_state'} = $syslog_state; +} if (keys(%$script_pram) == 0) { # print usage and die @@ -120,6 +135,7 @@ while ( my $line = ){ # start of a new message, plot saved log lines if ($line =~ /INFO: Incoming msg with session ID \d+ from / ) { if ($positive_msg) { + print "#####################################################\n"; print join("\n", @lines)."\n"; } @@ -148,6 +164,11 @@ while ( my $line = ){ my $l = &check_header($line); if (defined $l) { $positiv_counter++; } } + + elsif ($pram eq 'syslog_state') { + my $l = &check_syslog_state($line); + if (defined $l) { $positiv_counter++; } + } } if (keys(%$script_pram) == $positiv_counter) {