<div dir="auto">Hi Matthias,<div dir="auto"><br></div><div dir="auto">May I ask, is the key 'MESSAGE' fix and the value is changing between messages?</div><div dir="auto">For that you could parse the incoming json with json-parser() and store the parsed key-values, then you can easily set the desired SDATA field with a rewrite rule.</div><div dir="auto"><br></div><div dir="auto">Alternatively, you can set the "store-matches" flag for filters and use the matching groups in a follow-up rewrite rule.</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Gábor</div><div dir="auto"><br></div><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Tue, 29 Jun 2021, 10:42 Matthias Gruber, <<a href="mailto:MGruber@metzler.com">MGruber@metzler.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span style="font-size:10pt;font-family:sans-serif">Hi!</span>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">I hope it is simple
and my thoughts and seeks about it were to complicated :-), simply I didnt
know how to do that, perhaps someone has a clue for me</span>
<br>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">I am getting e.g.
messages like</span>
<br><span style="font-size:10pt;font-family:sans-serif">"MESSAGE":
"UIMUC4Maintenance.py: \"== deactivate_uc4_monitoring = ENDE
==\"",</span>
<br><span style="font-size:10pt;font-family:sans-serif">(thats out of
an JSON-formatted syslog-ng output),</span>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">What I would like
to do is, to extract the 'UIMUC4Maintenance.py:' and put it into a SDATA-Custom-Variable
or PROG but based on a regex</span>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">so some sort of
rewrite-rule like (no not a correct syntax, only to describe it)</span>
<br><span style="font-size:10pt;font-family:sans-serif">rewrite r_fill_program
{</span>
<br><span style="font-size:10pt;font-family:sans-serif">  set(match("^\w*\.py:"
value("MESSAGE")) value("PROG"));</span>
<br><span style="font-size:10pt;font-family:sans-serif">};</span>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">As far as I understand
it, set requires a "string" as first parameter, I could use a
lots of rewrites with a condition, but I am in "lack of a static string",
this should be some sort of variable :-)</span>
<br><span style="font-size:10pt;font-family:sans-serif">or I could do
that static with a filter for every "^\w*\.py:"-Text, but I hope
I could do that dynamic, every time a match of my regex syslog-ng inserts
that part into a variable and so on...</span>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">Is that possible?</span>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">cheers</span>
<br><span style="font-size:10pt;font-family:sans-serif">Matthias</span>
<br>
<br><span style="font-size:10pt;font-family:sans-serif">------------------------------------------------------------------------------------<br>
METZLER <br>
Informationstechnologie<br>
<br>
Matthias Gruber <br>
IT-Infrastruktur & -Betrieb<br>
<br>
B. Metzler seel. Sohn & Co.<br>
Aktiengesellschaft<br>
Untermainanlage 1<br>
60329 Frankfurt am Main<br>
Telefon (0 69) 21 04 - 43 30<br>
Telefax (0 69) 21 04 - 40 40<br>
<a href="mailto:MGruber@metzler.com" target="_blank" rel="noreferrer">MGruber@metzler.com</a><br>
</span><a href="http://www.metzler.com" target="_blank" rel="noreferrer"><span style="font-size:10pt;font-family:sans-serif">www.metzler.com</span></a>
<br><font size="2" face="Arial"><font size="2" face="Arial"> </font></font><br>
<br>
<font size="2" face="Arial">Vorstand: Harald Illy, Emmerich Müller, Gerhard Wiesheu</font><br>
<font size="2" face="Arial">Vorsitzender des Aufsichtsrats: Dr. Christoph Schücking</font><br>
<font size="2" face="Arial">Sitz der Gesellschaft: Frankfurt am Main, Handelsregister-Nr. </font><font size="2" face="Arial">HRB 123 365</font><br>
<br>
<font size="2" face="Arial"><font size="2" face="Arial">Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfänger sein, so bitten wir Sie höflich, dies unverzüglich dem Absender mitzuteilen und die Nachricht zu löschen. Es ist unzulässig, die Nachricht unbefugt weiterzuleiten oder zu kopieren. Da wir nicht die Echtheit oder Vollständigkeit der in dieser Nachricht enthaltenen Informationen garantieren oder zusichern können, sind die vorstehenden Ausführungen rechtlich nicht bindend. Eine Haftung hierfür wird ausgeschlossen.</font></font><br>
<font size="2" face="Arial"><font size="2" face="Arial">This message is confidential. If you are not the intended recipient, we kindly ask you to inform the sender and delete the information. Any unauthorised dissemination or copying hereof is prohibited. As we cannot guarantee or assure the genuineness or completeness of the information contained in this message, the statements set forth above are not legally binding. Accordingly we cannot accept any liability for their contents.</font></font>
______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer 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 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 noreferrer" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
</blockquote></div></div>