<div dir="ltr">btw: this is the branch that adds '.' as a possible key delimiter:<br><br><a href="https://github.com/balabit/syslog-ng/pull/1271">https://github.com/balabit/syslog-ng/pull/1271</a><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 11, 2016 at 7:13 AM, Balazs Scheidler <span dir="ltr"><<a href="mailto:bazsi77@gmail.com" target="_blank">bazsi77@gmail.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="auto"><div dir="auto">Keys have to consist of [A-Za-z0-9-_] and doing a restriction is pretty important to identify keys in odd formats.</div><div dir="auto"><br></div><div dir="auto">We can change the set of characters pretty easily but for now it is hardcoded.</div><div dir="auto"><br></div>I have a pending patchset that adds '.' as a char, as I needed that, and that's what syslog-ng uses to separate key portions.<div dir="auto"><br></div><div dir="auto">Would using a dot work for you? Then it would ve pretty easy to do the json conversion right within syslog-ng.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Something like:</div><div dir="auto"><br></div><div dir="auto">parser { kv-parser(); };</div><div dir="auto">destination { file("foobar" template("$(format-json *)\n")); };</div><div dir="auto"><br></div><div dir="auto">Format json would generate embedded objects at dot boundaries.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Dec 11, 2016 00:03, "David Boles (dboles)" <<a href="mailto:dboles@micron.com" target="_blank">dboles@micron.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am trying to process structured data coming from the Linux kernel's printk_emit() function which shows up on /dev/kmesg. Since printk_emit() forces you to flatten hierarchical data into key/value pairs I use a character delimiter between pieces of the key. So, with the '!' character as a separator something that looks like { "cat": { "family" : "mammal" } } would become "cat!family=mammal".<br>
<br>
When I use a kv-parser, and I use characters like '.', '$', '!', '+' or '^' as a separator the parser seems to just discard everything in the key except the last part. Alphabetic characters and '_' appear to work - but they are the most likely to conflict with other strings.<br>
<br>
Is there some way to tell the kv-parser to only consider '=' as special (or whatever the separator was defined to be) and keep my keys intact?<br>
<br>
Thanks,<br>
<br>
- db<br>
<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>
</blockquote></div></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Bazsi</div>
</div>