<div dir="ltr"><div><div><div>Hi,<br><br></div>Adding a NUL via the template is difficult as the template compiler works with zero terminated string, and even though the lexer allows the use of \x0, this will indicate the end-of-the-string like you have seen it.<br>
<br></div>Adding a zero byte would be possible by writing a template function $(format-gelf) and that probably could sit within the json module, reusing the infrastructure there.<br><br></div>On the other hand, I&#39;ve checked the GELF specification, and I can&#39;t see the NUL byte being required.<br>
<br><a href="http://graylog2.org/gelf#specs">http://graylog2.org/gelf#specs</a><br><br><div class="gmail_extra">Are you sure this is the issue?<br><br></div><div class="gmail_extra">Bazsi<br><br></div><div class="gmail_extra">
<br><div class="gmail_quote">On Thu, Aug 7, 2014 at 11:09 AM, Nicolas Fédou <span dir="ltr">&lt;<a href="mailto:nicolas.fedou@gmail.com" target="_blank">nicolas.fedou@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Hello,<br>
I need to send a null character at the end of a message on a tcp output...<br>
But this null is considered to be an end of string.</p>
<p dir="ltr">My use case is sending a GELF message to a graylog&#39;s tcp input.<br>
GELF message is a json syntax quite simple to comply with thanks to format-json.<br>
Graylog needs a null character at the end of a GELF message in TCP but not in UDP.</p>
<p dir="ltr">I tried many combination in the template with \x0, echo \x0, `global_definition_of_null`, etc...<br>
The matter is that null character when interpreted is an end of string, and is not written in the tcp message.<br>
I see truncated messages with ngrep.<br>
Like &quot;a\x0b&quot; gives &quot;a&quot; according to ngrep.</p>
<p dir="ltr">I did not find any option to actually write a null character.<br>
Do you have any options ?</p>
<p dir="ltr">As Graylog already have clients and librairies I belive they won&#39;t remove the need for a null character.<br>
Shall I open an issue on syslog-ng to ask for an option in templates or in format-json ?</p>
<p dir="ltr">Regards, Nicolas Fédou.</p>
<br>______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Bazsi
</div></div>