<div dir="ltr"><div>My application was sending empty pairs which would be passed on through syslog-ng.<br></div><div><br></div><div>The first idea was having syslog-ng turn { "key1":"val1", "key2":"" } into { "key1":"val1" }<br></div><div><br></div><div>Instead i've modified my service to validate every field before encoding the json string so it never sends empty fields to begin with. This solves the issue with my application but there may still be a use case for other applications where app-side validation is not an option.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 22, 2018 at 3:38 AM, Scheidler, Balázs <span dir="ltr"><<a href="mailto:balazs.scheidler@balabit.com" target="_blank">balazs.scheidler@balabit.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>Hmm, it was a feature to handle zero length values properly, and at the same time I've added the unset() rewrite operation, which causes name-value pairs to be omitted.<br><br></div>It might make sense to add a --skip-empty-values or similar option to $(format-json), would that solve your problem? Can you elaborate your use-case?<br><br></div>Thanks<br></div><div class="gmail_extra"><br clear="all"><div><div class="m_2171397166533099567gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <br>Bazsi<br></div></div></div>
<br><div class="gmail_quote">On Tue, May 22, 2018 at 7:50 AM, Nik Ambrosch <span dir="ltr"><<a href="mailto:nik@ambrosch.com" target="_blank">nik@ambrosch.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi - I'm trying to figure out how to instruct json-parser() to exclude empty (or nonexistent) json pairs from being passed to it's template. This is possible with the csv parser using null("") but not json.</div><div><br></div><div>It seems that if i specify all my json-parser() pairs using --pair example=\"${MYMACRO}\" the desired behavior is achieved, however using --scope nv-pairs instead will log the empty values.</div><br></div>
<br>______________________________<wbr>______________________________<wbr>__________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/mailm<wbr>an/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<wbr>/documentation/?product=<wbr>syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" rel="noreferrer" target="_blank">http://www.balabit.com/wiki/sy<wbr>slog-ng-faq</a><br>
<br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>______________________________<wbr>__________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/<wbr>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/<wbr>support/documentation/?<wbr>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/<wbr>syslog-ng-faq</a><br>
<br>
<br></blockquote></div><br></div>