I am working on migrating a large syslog farm from syslog-ng 2.0.9 to 3.8.1.
I have incoming datagrams that look like this:
<14>Aug 14 21:28:49 pa01.foo.com 1,2017/08/14 21:28:49,009401031978,THREAT,url,...
The actual message starts just after the pa01.foo.com hostname.
On 2.0.9, I just used "$MSG" as my output template, and the output file would get:
1,2017/08/14 21:28:49,009401031978,THREAT,url,...
which is what I want.
On 3.8.1, it's deciding that the actual message starts is in a different place, my output looks like:
21:28:49,009401031978,THREAT,url,...
I lost the leading 1,2017/08/14
.
I discovered that setting flags(no-parse)
at the source and adding the syslog parser back into the pipeline with parser { syslog-parser(); };
works correctly. In summary:
source net_src1 { network( transport("udp") port(4514) flags(no-parse)); };
source net_src2 { network( transport("udp") port(5514)); };
source net_src3 { syslog( transport("udp") port(6514)); };
filter f_test { netmask(127.0.0.1/32); } ;
destination d_test1 { file("/data/syslog/test/1" template("$MSG\n")); };
log { source(net_src1); filter(f_test); parser { syslog-parser(); }; destination(d_test1); flags(final); };
destination d_test2 { file("/data/syslog/test/2" template("$MSG\n")); };
log { source(net_src2); filter(f_test); destination(d_test2); flags(final); };
destination d_test3 { file("/data/syslog/test/3" template("$MSG\n")); };
log { source(net_src3); filter(f_test); destination(d_test3); flags(final); };
If I send to port 4514 which disables the parse with flags(no-parse)
and then adds it back in with parser { syslog-parser(); };
, all is well. Traffic sent to ports 5514 or 6514 comes out missing the leading 1,2017/08/14
.
It seems the syslog-parser is parsing differently based on whether it is implicitly or explicitly put into the pipeline.
Is there a way to get the desired behaviour without have to use flags(no-parse)
and explicitly adding the parser back in?