<div dir="ltr"><div>Hi,</div><div><br></div><div>In your test file destination, the content of $MESSAGE is used (which is in raw XML format).</div><div>Additionally to the raw XML format, syslog-ng parses all XML tags and attributes and stores them as key-value pairs.</div><div>When you switch to format-json(), these key-value pairs are used instead of $MESSAGE, that's why your rewrite rule stops working.<br></div><div><br></div><div>My suggestion would be to change the rewrite rule to remove the unwanted text from the appropriate key-value pair.</div><div>For example,</div><div><br></div><div>subst(</div><div>    "This event.*",</div><div>    "DEADBEEF",</div><div>    value(".windowsevent.Event.a.b.c.Message")</div><div>    ...<br></div><div>);<br></div><div><br></div><div>The exact name of the key can be extracted from the JSON output.<br></div><div><br></div><div>--</div><div>László Várady<br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 28, 2018 at 8:31 PM Jim Hendrick <<a href="mailto:james.r.hendrick@gmail.com">james.r.hendrick@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am struggling with a configuration to rewrite specific sections of a Windows Event log message and then send them along to splunk (I think json is probably the easiest for splunk to ingest).<div><br></div><div>Many windows events contain extraneous text (e.g. "This event.....") that I would like to remove.</div><div><br></div><div>I have been able to rewrite it using a regex </div><div>"This event.*</Message>" and replacing that with "DEADBEEF</Message>"</div><div><br></div><div>The problem is that I can only see this in a test file destination and not in one that uses format-json (I set this up from the syslog-ng WEF configuration guide)</div><div><br></div><div>Has anyone done anything like this?</div><div><br></div><div>I think my problem is that I don't understand how the message is changed from it's arrival through processing. My test can rewrite it within MSG or MESSAGE - but when I try to use the rewrite() in the log statement using the format-json destination, nothing seems to be changed.</div><div><br></div><div>Tips?</div><div><br></div><div>Thanks!</div><div>Jim</div><div><br></div><div><br></div></div>
______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" rel="noreferrer" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" rel="noreferrer" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
</blockquote></div></div>