<div dir="ltr"><div>Hmm.. are you sure it's not because of an embedded line-break character of some sorts? the template mechanism does not handle embedded NULs properly, but otherwise should work just fine with binary characters if they are already part of the message.</div><div><br></div><div>can you please do a hexdump of what syslog-ng sends to the relay node? could you please send me the binary file and the accompanying source statement?<br></div><div><br></div><div>thank you.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 18, 2018 at 10:24 AM Jose Angel Santiago <<a href="mailto:jasantiago@stratio.com">jasantiago@stratio.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi, I'm using syslog-ng 3.18.1, and I'm having some issues due to my special use case.<br></div><div><br></div><div>Unfortunately my syslog-ng agent reads some binary files which are piped through the log file I'm processing and sending it to elasticsearch. When this happens, the elastic bulk post fail (So I'am affected by this issue <a href="https://github.com/balabit/syslog-ng/issues/1993" target="_blank">https://github.com/balabit/syslog-ng/issues/1993</a>). I've debugged it and the problem was that message generated when applying the template is empty.</div><div><br></div><div>This is my network destination:<br></div><div><br></div><div>destination d_syslog_tcp {<br> network(<br></div><div> "syslog-relay.node"<br></div><div> port(7601)<br> template("${ISODATE} ${HOST} ${CONTAINER-IP} ${MESSAGE}\n")<br> template-escape(no)<br> disk-buffer(<br> mem-buf-size(200M)<br> disk-buf-size(500M)<br> reliable(yes)<br> dir("/var/syslog-ng")<br> )<br> );<br>};<br></div><div><br></div>I've opened a netcat server as syslog-relay.node and piped a small binary file through the stdout file which I'm using as source, and this what the relay receives:</div><div dir="ltr"><br></div><div dir="ltr"><font size="1">2018-12-17T15:35:57+00:00 agent-4 192.168.54.17 � <br>2018-12-17T15:35:57+00:00 agent-4 192.168.54.17 3F<br>2018-12-17T15:35:57+00:00 agent-4 192.168.54.17 <br> $<br>2018-12-17T15:35:57+00:00 agent-4 192.168.54.17 4) </font><br><br></div><div>As you can see, fourth message has no timestamp, hostname or ip address, it only contains "$"char, so when this message is sent to elastic, I've got a mapperException since it tries to validate the received timestamp.<br></div><div>I know I can customize elastic so it doesn't fail in case a wrong timestamp is received, but the point is that syslog-ng seems to fail when templating the message, doesn't it?</div><div><br></div><div>Also it would be great if syslog-ng had any mechanism to filter all those binary messages, I've already tried with filter expression, excluding all non-printable chars, but the issue still happens.</div><div><br></div><div>Regards.<br></div><div><br></div><div dir="ltr"><br></div><div dir="ltr"><div>-- <br><div dir="ltr" class="gmail-m_8747694410451953117gmail-m_2269236669992505383gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><div><div style="color:rgb(136,136,136);font-size:12.8px"><div dir="ltr"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:12.7273px"><span style="font-size:9pt;font-family:Tahoma;color:rgb(217,217,217);font-weight:700;vertical-align:baseline;white-space:pre-wrap">|</span><span style="font-size:9pt;font-family:Tahoma;color:rgb(102,102,102);vertical-align:baseline;white-space:pre-wrap"> Jose Angel Santiago</span><br></div><div style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:12.7273px"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.7273px"><span><br><p dir="ltr" style="line-height:1.656;margin-top:0pt;margin-bottom:0pt"><a href="http://www.stratio.com/" target="_blank"><span style="font-size:10pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><img style="border: medium none;" alt="Logo_signature2.png" width="96" height="22"></span></a></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:Tahoma;color:rgb(153,153,153);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Vía de las dos Castillas, 33, Ática 4, 3ª Planta</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:Tahoma;color:rgb(153,153,153);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">28224 Pozuelo de Alarcón, Madrid, Spain </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:8pt;font-family:Tahoma;color:rgb(153,153,153);vertical-align:baseline;white-space:pre-wrap">+34 918 286 473 | </span><a href="http://www.stratio.com" target="_blank"><span style="font-size:8pt;font-family:Tahoma;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap">www.stratio.com</span></a></p><a href="https://twitter.com/stratiobd" target="_blank"><span style="font-size:10pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><img style="border: medium none;" width="20" height="20"></span></a><a href="https://www.linkedin.com/company/stratiobd" target="_blank"><span style="font-size:10pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><img style="border: medium none;" width="20" height="20"></span></a><a href="https://www.youtube.com/c/StratioBD" target="_blank"><span style="font-size:8pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;font-style:italic;vertical-align:baseline;white-space:pre-wrap"><img style="border: medium none;" width="20" height="20"></span></a></span><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
______________________________________________________________________________<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>
</blockquote></div>