<div dir="ltr"><div><div>Hi,<br><br></div><div>I think I've found the reason why it is parsed differently:<br><br></div><div>- we added support for parsing Cisco style sequence numbers (that's 45 in your example), so that does not get parsed as program name<br></div><div>- however, we don't support timezones in the timestamps above, so GMT is being parsed as PROGRAM<br></div><div>- adding support is not as simple as it sounds, as it conflicts with other log formats, as generally the host or program name is the next field, and those can be "GMT" as well.<br><br></div><div>This is what I would do:<br><br></div><div>- receive the messages using no-parse, then your entire message as received is available in $MSG<br></div><div>- grab the timestamp with a regexp (e.g. message("<regexp>" flags(store-matches)))<br></div><div>- use date-parser() to parse the timestamp<br></div></div><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <br>Bazsi<br></div></div></div>
<br><div class="gmail_quote">On Wed, Apr 26, 2017 at 3:43 PM, Nik Ambrosch <span dir="ltr"><<a href="mailto:nik@ambrosch.com" target="_blank">nik@ambrosch.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">These are Cisco devices, I can reproduce with both old and new versions of ios.  Here is another message - i logged it twice, once with no-parse and one without that flag.<br>
<br>
(using no flags):  %SYS-5-CONFIG_I: Configured from console by xxx on vty0 (0.0.0.0)<br>
(no-parse flag):   <189>45: Apr 25 21:36:17.452 GMT: %SYS-5-CONFIG_I: Configured from console by xxx on vty0 (0.0.0.0)<br>
<br>
Regarding the config & version - we moved from 3.3 to 3.9.  The behavior occurs when using sql() and program() destinations, i have not tried others but I would assume the same since it’s the value of a macro.<br>
<br>
For reference, here is my old and new configuration for my database destination - note ${DEVICE_TYPE} is a custom macro.<br>
<br>
old:<br>
<br>
columns("id int(11) unsigned not null auto_increment primary key", "host varchar(100) not null", "facility varchar(10)", "priority varchar(10)", "level varchar(10)", "program text", "date date not null", "time time not null", "message text not null")<br>
values("", "$FULLHOST", "$FACILITY", "$PRIORITY", "$LEVEL", "$PROGRAM", "$R_YEAR-$R_MONTH-$R_DAY", "$R_HOUR:$R_MIN:$R_SEC", "$MSG")<br>
<br>
<br>
new:<br>
<br>
columns("id int(11) unsigned not null auto_increment primary key", "host varchar(100) not null", "host_resolved varchar(60)", "facility varchar(10)", "priority varchar(10)", "level varchar(10)", "program varchar(60)", "date_local datetime not null", "date_remote datetime", "device_type varchar(13)", "message mediumblob not null")<br>
values("0", "${FULLHOST}", "${FULLHOST_FROM}", "${FACILITY}", "${PRIORITY}", "${LEVEL}", "${PROGRAM}", "${R_YEAR}-${R_MONTH}-${R_DAY} ${R_HOUR}:{$R_MIN}:${R_SEC}", "${S_YEAR}-${S_MONTH}-${S_DAY} ${S_HOUR}:${S_MIN}:${S_SEC}", "${DEVICE_TYPE}", "${MSG}")<br>
<br>
Thanks.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
> On Apr 26, 2017, at 3:45 AM, Sandor Geller <<a href="mailto:sandor.geller@ericsson.com">sandor.geller@ericsson.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> The app producing these logs violates all syslog standards (there are so many apps written by people ignoring standards...). In my opinion syslog-ng is correct in assuming that the first doublecolon ends the syslog header and the string containing the doublecolon is the program name. I  don't know how could the older version mis-parse the message to pick up a not even existing string from the message as the program name.<br>
><br>
> Handling of $MSG AKA $MESSAGE changed with syslog-ng 3.0 and with recent configs (versioned ones having at least 3.0 in the version number) it no longer contains the syslog header. Were you using an old (unversioned) configfile and relied on 2.x behaviour maybe? syslog-ng outputs warnings about such behaviour changes when it starts.<br>
><br>
> The documentation also contains this information so it is a good read.<br>
><br>
> Regards,<br>
><br>
> Sandor<br>
><br>
> On 04/25/2017 09:23 PM, Nik Ambrosch wrote:<br>
>> After moving from syslog-ng 3.5 to 3.9 i noticed that the contents of $PROGRAM and $MSG are being logged differently than before.  Here is how they used to be logged:<br>
>><br>
>> # program: 53<br>
>> # message: Apr 19 09:35:35.713 GMT: %ILPOWER-5-POWER_GRANTED: Interface xxx: Power granted                                 |<br>
>><br>
>> That is the full message (as seen on the device) which is optimal behavior.  Below is the behavior i’m seeing with syslog-ng 3.9 with similar configuration:<br>
>><br>
>> # program: GMT<br>
>> # message: %ILPOWER-5-POWER_GRANTED: Interface xxx: Power granted<br>
>><br>
>> The value of program and message are altered but everything else is the same.  I’ve been investigating the date parser and the flags(no-parse) options but haven’t had any luck getting a properly formatted message yet.<br>
>><br>
>> If anyone has any ideas on how to get the old behavior back it would be greatly appreciated.<br>
>><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>
><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>
______________________________<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>
</div></div></blockquote></div><br></div>