<p dir="ltr">We need to order the keys to generate json from our flat name value structure.</p>
<p dir="ltr">There are a lot of things that make format-json slow, and could be sped up easily, at least in my opinion.</p>
<p dir="ltr">Sorting doesn&#39;t help either, but unfortunately that part is needed.</p>
<div class="gmail_quote">On Oct 31, 2015 3:52 PM, &quot;Evan Rempel&quot; &lt;<a href="mailto:erempel@uvic.ca">erempel@uvic.ca</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<pre style="word-wrap:break-word;font-size:10.0pt;font-family:Tahoma;color:black">I am surprised that it orders them at all. The json object is key name specific, with ordering of list elements the only place where order could be important.

I would think that sorting the keys is just a waste of time. The json format output is currently performance limited to around 15,000 events per second on the latest generation of CPU.

I would be in favor of doing ANYTHING that could speed that up. Perhaps the ability to sort, and the ascending/descending order should be options to the json output template.



Evan

&quot;Scheidler, Balázs&quot; &lt;<a href="mailto:balazs.scheidler@balabit.com" target="_blank">balazs.scheidler@balabit.com</a>&gt; wrote:

</pre>
<div>
<div dir="ltr">
<div>
<div>
<div>Hi,<br>
<br>
</div>
I&#39;ve encountered a case where format-json orders keys not alphabetically, but rather in the other direction. Can you remember any reason for that?<br>
<br>
</div>
This is the only patch needed to fix the order, but I&#39;ve figured there may have been some reason behind the ordering.<br>
<br>
 static gint<br>
 vp_walk_cmp(const gchar *s1, const gchar *s2)<br>
 {<br>
-  return strcmp(s2, s1);<br>
+  return strcmp(s1, s2);<br>
 }<br>
<br>
<br>
</div>
<div>Thanks in advance, <br>
</div>
<div>
<div><br clear="all">
<div>
<div>
<div>
<div dir="ltr">-- <br>
Bazsi<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<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>
<br></blockquote></div>