Dru has asked for the wisdom of the Perl Monks concerning the following question:
What I would like to do is get out the unique FW messages (ie %FW-3-106011 and %FW-2-108002) and when I print it out include just one of the log entries with it. For example I would like it to look like this:2003-12-22 15:48:35 Local4.Error 192.168.1.2 Dec 22 2003 20:48:25: %FW-3-106011: Deny inbound (No xlate) udp 4 dst inside:192.168.18.6/161 2003-12-22 23:52:00 Local4.Critical 192.168.1.2 Dec 23 2003 04:51:50: %FW-2-108002: SMTP replaced >: out 192.168.36.223 in 192.168.11.12 data: MAIL From: <123@hotmail.com>..
I know this isn't correct, but I gave it a stab:%FW-3-106011: 2003-12-22 15:48:35 Local4.Error 192.168.1.2 Dec 22 2003 20:48:25: %FW-3-106011: Deny inbound (No xlate) udp 4 dst inside:192.168.18.6/161
I appreciate any help.use strict; use warnings; my $file = 'd:\PROGRA~1\Syslogd\Logs\syslog22Dec2003.txt'; open (FILE, $file) or die "Can't open $file: $!\n"; my (@lines); while (<FILE>){ push (@lines, $_) if /(\%FW\-\d-\d+)/; next unless $1 !~ /$1/; #my stupid logic }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tricky Syslog Parsing
by Abigail-II (Bishop) on Jan 13, 2004 at 16:38 UTC | |
|
Re: Tricky Syslog Parsing
by Old_Gray_Bear (Bishop) on Jan 13, 2004 at 16:40 UTC | |
|
Re: Tricky Syslog Parsing
by blue_cowdawg (Monsignor) on Jan 13, 2004 at 16:56 UTC | |
by Dru (Hermit) on Jan 13, 2004 at 19:21 UTC | |
by elwarren (Priest) on Jan 13, 2004 at 21:39 UTC | |
|
Re: Tricky Syslog Parsing
by Art_XIV (Hermit) on Jan 13, 2004 at 19:21 UTC | |
|
Re: Tricky Syslog Parsing
by elwarren (Priest) on Jan 13, 2004 at 21:50 UTC |