From: rettenbe Date: Thu, 13 Mar 2008 14:19:24 +0000 (+0000) Subject: parsing logfiles X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=51d8a463aab3e9af093246b33af70cb62a097952;p=gosa.git parsing logfiles git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9744 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/tests/log-parser.pl b/gosa-si/tests/log-parser.pl new file mode 100755 index 000000000..59912a8bf --- /dev/null +++ b/gosa-si/tests/log-parser.pl @@ -0,0 +1,51 @@ +#!/usr/bin/perl +#=============================================================================== +# +# FILE: log-parser.pl +# +# USAGE: ./log-parser.pl +# +# DESCRIPTION: +# +# OPTIONS: --- +# REQUIREMENTS: --- +# BUGS: --- +# NOTES: --- +# AUTHOR: (), <> +# COMPANY: +# VERSION: 1.0 +# CREATED: 13.03.2008 14:51:03 CET +# REVISION: --- +#=============================================================================== + +use strict; +use warnings; +use Getopt::Long; + +my $log_file = "/var/log/gosa-si-server.log"; + +my $session; +GetOptions("s|session=s" => \$session); + +if( not defined $session) { die "\tplease define a session to parse\n\ti.e. 'perl log-parser.pl -s 4'\n" }; + +print "session: $session\n"; + +open(FILE, "<$log_file") or die "\t can not open log-file"; + +# Read lines +my $line; +while ($line = ){ + next if $line =~ /^\s/; + + chomp($line); + my @line_list = split(" ", $line); + + next if not $line_list[4]; + + if($line_list[4] eq $session) { + + print "$line\n"; + + } +}