Help getting my rewrite to work
Good morning all, I'm having difficulties getting my rewrite statement to work properly. I've been spending more hours than I care to admit pouring through docs, examples, etc and just can't get it. (I really thought I was on the right track from a post in the May archives) In short, I am using syslog-ng 3.4.2 to receive my Windows event logs. There are several common Windows events that includes a detailed description of the event EVERY TIME that I am trying to drop before writing to my syslog server, leaving just the meat. I originally wanted to start my testing by replacing a single word (i.e. the word "interactive" so that I could make sure the re-write rule was working before I tweaked my regex.) However, whenever I add my rule it's not logging any event that matches at all, and I'm not sure why. I'm doing a tail on the log file and it just doesn't write (literally) anything at all. My examples... source s_syslog { udp(ip(0.0.0.0) port(514)); }; destination d_allwindows { file("/syslog/log/windows/hosts/$HOST/$R_YEAR/$R_MONTH/$R_DAY/$HOST$YEAR$MONTH$DAY" create_dirs(yes)); }; rewrite r_rewrite_4624_2 { subst("interactive", "QuackApple", value("MSGONLY"));}; ("interactive" is contained in the message, so it was an easy one to pickout for testing, and I used the string "QuackApple" as the replacement as I know it won't naturally appear, so I can search on it easily) log { source(s_syslog); filter(f_allwindows); rewrite(r_rewrite_4624_2); destination(d_allwindows); }; With these rules in place, the log is actually dropped, not re-written. If I change my rewrite rule to be something not found (i.e. replace "interactive" with "ZZowkr" then the events start showing up in the tail again) Thanks! Dave Vernon
Hi Dave,
rewrite r_rewrite_4624_2 { subst("interactive", "QuackApple", value("MSGONLY"));};
I'm using something similar, but am using the type and flags options: rewrite r_use_basename { subst( "/var/log/apache2/", "", value(".SDATA.file@18372.4.name") type("string") flags("prefix") ); };
From the admin pdf:
string Description: Match the strings literally, without regular expression support. By default, only identical strings are matched. For partial matches, use the flags("prefix") or the flags("substring") flags. One would think that your regex would match, though. Cheers, -mz
Progress! rewrite r_rewrite_4624_2 { subst("(interactive)", "QuackApple", value("MSGONLY") type("string") flags("substring"));}; works to replace the single word.. Now to build upon that! (I had previously added the substring flag but had never used the 'string' type AND the substring flag at once Dave Vernon Technology Infrastructure Specialist Information Technology Services Loyalist College 613-969-1913 x2827 dvernon@loyalistc.on.ca | www.loyalistcollege.com -----Original Message----- From: syslog-ng-bounces@lists.balabit.hu [mailto:syslog-ng-bounces@lists.balabit.hu] On Behalf Of Matt Zagrabelny Sent: Friday, July 19, 2013 12:30 PM To: Syslog-ng users' and developers' mailing list Subject: Re: [syslog-ng] Help getting my rewrite to work Hi Dave,
rewrite r_rewrite_4624_2 { subst("interactive", "QuackApple", value("MSGONLY"));};
I'm using something similar, but am using the type and flags options: rewrite r_use_basename { subst( "/var/log/apache2/", "", value(".SDATA.file@18372.4.name") type("string") flags("prefix") ); };
From the admin pdf:
string Description: Match the strings literally, without regular expression support. By default, only identical strings are matched. For partial matches, use the flags("prefix") or the flags("substring") flags. One would think that your regex would match, though. Cheers, -mz ______________________________________________________________________________ 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
participants (2)
-
Dave Vernon
-
Matt Zagrabelny