<div dir="ltr">Hi,<br><br><br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">-- <br>Bazsi<br></div></div></div>
<br><div class="gmail_quote">On Mon, Nov 2, 2015 at 6:39 AM, Gergely Nagy <span dir="ltr">&lt;<a href="mailto:algernon@madhouse-project.org" target="_blank">algernon@madhouse-project.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Oct 31, 2015 at 1:28 PM, Scheidler, Balázs<br>
&lt;<a href="mailto:balazs.scheidler@balabit.com">balazs.scheidler@balabit.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;ve encountered a case where format-json orders keys not alphabetically,<br>
&gt; but rather in the other direction. Can you remember any reason for that?<br>
<br>
</span>It&#39;s for the flat format =&gt; structured format conversion. Consider you<br>
have keys like a.b.c, a.b.d, a.b.e, a.c.a, a.c.f. With reverse<br>
sorting, you get a.c.f first, and generate an f key, then a, and<br>
collect that into c. Then you get the b stuff, and then wrap them all<br>
in a. It may be possible to do it the other way around, generating a<br>
first, and extending it, but this order is more straightforward in my<br>
opinion.<br></blockquote><div><br></div><div>It seems to have worked by flipping the order, but maybe I wasn&#39;t testing it enough. I don&#39;t understand your example, though, &quot;f&quot;, then &quot;a&quot;, then &quot;c&quot;, the original example was a.c.f<br><br></div><div>But since there&#39;s a definite reason for the ordering, I&#39;m dropping the reordering patch.<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I also seem to remember needing this for array support, but I&#39;m not<br>
exactly sure of that.<br></blockquote><div><br></div><div>this makes sense at least as long as the index is alphabetically sortable (e.g. the same length), with stuff where indexes contain variable length numbers (10 sorts before 9), it probably wouldn&#39;t work.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
As for getting rid of sorting: that&#39;d just make things slower in the<br>
end, unless syslog-ng starts storing its key-value pairs in an already<br>
structured format. But even then, my gut feeling is that sorting is<br>
still faster. If the data is unsorted, you&#39;d have to hunt down where<br>
to insert the new keys, possibly deep into other structures. That<br>
sounds very inefficient. Also considerably more code</blockquote><div><br></div><div>Yup, sorting is an architectural must at least now. <br></div></div><br></div></div>