<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Fabien,</div><div dir="ltr"><br></div><div dir="ltr">Thanks for your response.<div><br></div><div>I was using this snippet of code (taken from documentation) before, but doesn't seem to work either:</div><div><br></div><div><div><b>value("MESSAGE" "$(format-json .auditd.*)")</b></div><div><b><br></b></div><div>So how do I output an aggregated message to the test.json file ? Or any file.<b><br></b></div><div><br></div></div><div>I apologize if my questions are basic, but I had a hard time finding answers in documentation. Grouping-by() function could definitely use more explanation.</div><div><br></div><div>Kind regards</div><div>Maciej</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">wt., 3 lis 2020 o 13:05 Fabien Wernli <<a href="mailto:wernli@in2p3.fr">wernli@in2p3.fr</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Maciek,<br>
<br>
On Tue, Nov 03, 2020 at 12:24:40PM +0100, Maciek Solnicki wrote:<br>
> * destination {*<br>
> * file('/tmp/test.json' template("$(format-json .auditd.*)\n"));*<br>
> * };*<br>
> *};*<br>
<br>
This means you're outputting the contents of all `.auditd.` macros to file<br>
test.json.<br>
<br>
But your grouping-by parser generates a message with the macro MESSAGE set<br>
to the value "TEST" :<br>
<br>
> * grouping-by(*<br>
> * key("${.auditd.msg}")*<br>
> * timeout(10)*<br>
> * aggregate(value("MESSAGE" "TEST"))*<br>
> * );*<br>
<br>
So you won't see it in test.json.<br>
Well, more exactly you should see it as the default value of<br>
aggregate(inherit-mode()) is "context", but you won't see the MESSAGE:TEST<br>
macro as you're omitting it from your output.<br>
I'm guessing you should see a message twice in that case.<br>
<br>
______________________________________________________________________________<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>