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 }
In reply to Tricky Syslog Parsing by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |