<div dir="ltr">Hi Asif!<br><br>I think the problem with the first message comes from the message structure and the filter statement.<div>Its structure does not conform to either syslog RFC standards (RFC3164 or RFC5424).</div><div>Syslog-ng still tries to parse the log message by its internal heuristics and the "alarmLog" text is parsed as the 'program' field.</div><div>You can debug syslog-ng parsing with the format-json template in the destination:</div><div> `template("$(format-json -s syslog-proto)\n")`</div><div><br></div><div>The output for this was:</div><div><div>{"PROGRAM":"alarmLog,","PRIORITY":"notice","MESSAGE":"applianceName=Branch-UC1, tenantName=DEMO-CORP, alarmType=sla-not-met, alarmKey=INTERNET, generateTime=1521503387, applianceId=1, vsnId=0, tenantId=2, alarmCause=datapathState, alarmClearable=yes, alarmClass=cleared, alarmKind=symptom, alarmEventType=equipmentAlarm, alarmSeverity=cleared, alarmOwner=tenant, alarmSeqNo=1568, alarmText=delay:9 msec, siteName=Branch-UC1","HOST":"+0000","FACILITY":"user","DATE":"Mar 13 23:49:48"}</div></div><div><br></div><div>The filter statement uses the `match()` filter which works on both the header and message part of the log message and thus would match for the first log message if the `value("MESSAGE")` part would not be there.</div><div>With that you restricted the filter to match only on the message part.</div><div>If you remove the value("MESSAGE") from the filter statement it will work.<br></div><div><br></div><div>Regards,</div><div>Gabor</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 20, 2018 at 1:52 AM, Asif Iqbal <span dir="ltr"><<a href="mailto:vadud3@gmail.com" target="_blank">vadud3@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="ltr"><div>syslog-ng is <b><font color="#ff0000">NOT</font></b> writing syslog like this to a file which has no <<b>PRI</b>></div><div><br></div><div>23:49:48.306587 IP 192.168.1.100.39567 > 192.168.100.100.514: [|syslog]</div><div>E.....@.>..U...g..........T.<wbr>2018-03-19T23:49:48+0000 alarmLog, applianceName=Branch-UC1, tenantName=DEMO-CORP, alarmType=sla-not-met, alarmKey=INTERNET, generateTime=1521503387, applianceId=1, vsnId=0, tenantId=2, alarmCause=datapathState, alarmClearable=yes, alarmClass=cleared, alarmKind=symptom, alarmEventType=equipmentAlarm, alarmSeverity=cleared, alarmOwner=tenant, alarmSeqNo=1568, alarmText="delay:9 msec", siteName=Branch-UC1</div><div>................</div><div><br></div><div><br></div><div>syslog-ng is writing syslog like this to a file <b>OK </b></div><div><br></div><div>23:50:26.930023 IP 192.168.1.100.55078 > 192.168.100.100.514: SYSLOG <a href="http://mail.info" target="_blank">mail.info</a>, length: 76</div><div>E..h.B@.>......g.....&...Tt.<<wbr>22>Mar 19 23:50:26 SVL-remotehost-02 root: this is third test alarmLog................</div><div><br></div><div><br></div><div>Here is my syslog-ng config</div><div> source s_udp { udp(ip(0.0.0.0) port(514)); };<br></div><div><div> destination d_alarm { file("/var/log/alarms.log"); };</div><div> filter f_alarm { match("alarmLog" value("MESSAGE")); };<br></div><div> log { source(s_udp); filter(f_alarm); destination(d_alarm); };<br></div></div><div><br></div><div>I am using syslog-ng version 3.5.6 on centos 7</div><div><br></div><div>Any idea why syslog-ng is writing the first log event into a file?</div><div><br></div><div>Appreciate any help!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div>-- <br><div class="m_-7794152780587771181gmail_signature">Asif Iqbal<br>PGP Key: 0xE62693C5 KeyServer: <a href="http://pgp.mit.edu" target="_blank">pgp.mit.edu</a><br>A: Because it messes up the order in which people normally read text.<br>Q: Why is top-posting such a bad thing?<br><br></div>
</font></span></div>
<br>______________________________<wbr>______________________________<wbr>__________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/<wbr>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/<wbr>support/documentation/?<wbr>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/<wbr>syslog-ng-faq</a><br>
<br>
<br></blockquote></div><br></div>