cisco rewrite code
Does anyone have a pre build set of patterns/rewrite rule to rewrite all cisco logs into something that is a little more compliant? We are trying to use a master pattern database to identify/classify messages, but the cisco logs don't have usable "program names" so the pattern database can't even get started :-( Thanks for any pointers. -- Evan
The best would be to write a cisco mnemonic parser that would transform that stuff to name-value pairs. Also we've used the program name portion in patterndb to parse out those. iirc it starts with % ----- Original message -----
Does anyone have a pre build set of patterns/rewrite rule to rewrite all cisco logs into something that is a little more compliant?
We are trying to use a master pattern database to identify/classify messages, but the cisco logs don't have usable "program names" so the pattern database can't even get started :-(
Thanks for any pointers.
-- Evan ______________________________________________________________________________ Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng FAQ: http://www.balabit.com/wiki/syslog-ng-faq
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/12/2012 06:04 PM, Evan Rempel wrote:
Does anyone have a pre build set of patterns/rewrite rule to rewrite
all cisco
logs into something that is a little more compliant?
We are trying to use a master pattern database to identify/classify messages, but the cisco logs don't have usable "program names" so the pattern database can't even get started :-(
Thanks for any pointers.
Hello :) What I usually do is to filter with something like that : filter ciscoIos { facility(local7) or (program("%PIX-[^-]+-[^-]+") or program("%ASA-[^-]+-[^-]+") or program("%FWSM-[^-]+-[^-]+")); }; then I send log back to 127.0.0.1 with cisco as program name and specifying the message field. rewrite rs_cisco { set('$PROGRAM: $MESSAGE' value("MESSAGE")); set("cisco" value("PROGRAM")); }; Hope that help you.. Seb -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQIcBAEBAgAGBQJQeHDQAAoJEE3IBph3MKVPDrYP/ial1cK+nqY59vYiGucIX/sB dVvMNtbcbmFESNkNRhzWeVNMpv2dTOT2RzA1NbLtYA2uqDbMK5j3ltqK66q1YYNx UJ5+sUvc/t+jH7UblDkKTcgfY4uBikYNJfLNg6rljmp15xd6O60s0zJV+fdamGxw f6fR8XucVsYIdk8pS7L4/bNcYDPT+zjQp2CA1mfuvmOFJjK/k69Hh8mkNFsaWVxd prCmRqYGHBfhUv/AG1wU96y/WN1pXVhl+9lsEH9ZdreBOSQyNcEq56FcwxH/9WdX OdLQuG2YD96XrrXdjH53xb5D7rUsJp2BnavrE0+AQ8qUuDb5tVEZn+4qwoUQmiGj Qjj6cwVqYsiWLR7ReKl6XXQR9O5VIiUg42ic7D175NHFKT3dP6wBrS+GUXciesgF q6FUE8cRB+whVYXU5R/QPdgVzCdZkT7lZlkUceHAsRpjzNtjqAbxFcBSBs4171B1 jWPzFEmlViQVZm1N0Gt17s5maYaUDl06LtgEkL/pnjZpBIPwvUBMqV+4kRToFOkQ KSoqRcjqXBPHE3SrpuEI5hiySZNVr2XCb1csLLE5yfkRMCTLGDZhVLwHLxRb+IqL FPvtyxDIWB+kY/Qvbu7QdVk9b9Z5qMt6C/37Bls/5/z1Xzh4TYI57anoelcv84FG RtBdVGBJ4x4UTGE5ADD6 =OOMA -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I use the following to set the program name to the so called mnemonic: filter f_rewrite_cisco_program { match('%([^:]+):\s+([^\n]+)' value("MESSAGE") type("pcre") flags("store-matches" "nobackref")); }; rewrite r_cisco_program { set("$1", value("PROGRAM") condition(filter(f_rewrite_cisco_program))); set("$2", value("MESSAGE") condition(filter(f_rewrite_cisco_program))); }; But Martin from ELSA Project has a more sophisticated way to match the different types of timestamps included in the cisco message (it depends on your log timestamp configuration): filter f_rewrite_cisco_program { match('^(%[A-Z]+\-\d\-[0-9A-Z]+): ([^\n]+)' value("MSGONLY") type("pcre") flags("store-matches" "nobackref")); }; filter f_rewrite_cisco_program_2 { match('^[\*\.]?(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}(?:\.\d+)?(?: [A-Z]{3})?: (%[^:]+): ([^\n]+)' value("MSGONLY") type("pcre") flags("store-matches" "nobackref")); }; filter f_rewrite_cisco_program_3 { match('^\d+[ywdh]\d+[ywdh]: (%[^:]+): ([^\n]+)' value("MSGONLY") type("pcre") flags("store-matches" "nobackref")); }; filter f_rewrite_cisco_program_4 { match('^\d{6}: [\*\.]?(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}(?:\.\d+)?(?: [A-Z]{3})?: (%[^:]+): ([^\n]+)' value("MSGONLY") type("pcre") flags("store-matches" "nobackref")); }; rewrite r_cisco_program { set("$1", value("PROGRAM") condition(filter(f_rewrite_cisco_program) or filter(f_rewrite_cisco_program_2) or filter(f_rewrite_cisco_program_3) or filter(f_rewrite_cisco_program_4))); set("$2", value("MESSAGE") condition(filter(f_rewrite_cisco_program) or filter(f_rewrite_cisco_program_2) or filter(f_rewrite_cisco_program_3) or filter(f_rewrite_cisco_program_4))); }; hope it helps, regards, Tom On 12.10.2012 21:34, Sébastien Pasche wrote:
On 10/12/2012 06:04 PM, Evan Rempel wrote:
Does anyone have a pre build set of patterns/rewrite rule to rewrite all cisco logs into something that is a little more compliant?
We are trying to use a master pattern database to identify/classify messages, but the cisco logs don't have usable "program names" so the pattern database can't even get started :-(
Thanks for any pointers.
Hello :)
What I usually do is to filter with something like that :
filter ciscoIos { facility(local7) or (program("%PIX-[^-]+-[^-]+") or program("%ASA-[^-]+-[^-]+") or program("%FWSM-[^-]+-[^-]+")); };
then I send log back to 127.0.0.1 with cisco as program name and specifying the message field.
rewrite rs_cisco { set('$PROGRAM: $MESSAGE' value("MESSAGE")); set("cisco" value("PROGRAM")); };
Hope that help you..
Seb
______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng FAQ: http://www.balabit.com/wiki/syslog-ng-faq
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iD8DBQFQeHL1TCCRT+dccOYRAmKDAKDMZZ3NketEY94PN+CX2J5pa+vMkgCgo5PW GJROwdt07tKPljTiRNiaMTs= =LJfS -----END PGP SIGNATURE-----
participants (4)
-
Balazs Scheidler
-
Evan Rempel
-
Sébastien Pasche
-
Thomas Wollner