<div dir="auto"><div>Evan seems to be right, if the sending device is not adding line ends, we can't know where the log record ends.</div><div dir="auto"><br></div><div dir="auto">This format on TCP is pretty useless as TCP is line oriented, so the application doesn't know where the records terminate.</div><div dir="auto"><br></div><div dir="auto">To split this input one would need to split az the header (e.g. starting the <pri> field in the front), which should only fail is messages would contain similar sequences of characters.</div><div dir="auto"><br></div><div dir="auto">Maybe this is easier to process using UDP (if the device allows that), if the app sends these messages in different datagrams at least, that would work.</div><div dir="auto"><br></div><div dir="auto">The only other workaround I can think of is to write a frontend to syslog-ng that splits these messages and resend them to syslog-ng with good framing.</div><div dir="auto"><br>Bazsi</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Fri, Feb 3, 2023, 19:53 Dragan Zecevic <<a href="mailto:dragan.zecevic@live.com" rel="noreferrer noreferrer" target="_blank">dragan.zecevic@live.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hi Evan,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
thank you for your reply.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
I copied a part of the stored log file below. There is no line break between a lot of syslog messages and then just before (hashtags) this performance output it starts separating lines.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
And each performance stat is a new line. After that (right away after hashtags) it starts storing again without line breaks.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
This is mostly going on and on like this.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
I didn't change windows size so it should be default. Currently there is only one source host sending syslog messages.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
...<189>Jan 13 2023 13:29:58+02:00 hostname %%01SSH/5/SSHS_REKEY_STATUS(s):CID=xxx;SSH server key renegotiation with client. (SessionID=1, RekeyReason=Rekey timer timed out, Status=Success, UserAddress=x.y.w.z, LocalAddress=x.y.w.z, VPNInstanceName=_xxx_)<189>Jan
 13 2023 13:29:59+02:00 hostname %%01SSH/5/SSHS_REKEY_STATUS(s):CID=xxx;SSH server key renegotiation with client. (SessionID=2, RekeyReason=Rekey timer timed out, Status=Begin, UserAddress=x.y.w.z, LocalAddress=x.y.w.z, VPNInstanceName=_xxx_)<189>Jan 13 2023
 13:30:00+02:00 hostname %%01SSH/5/SSHS_REKEY_STATUS(s):CID=xxx;SSH server key renegotiation with client. (SessionID=2, RekeyReason=Rekey timer timed out, Status=Success, UserAddress=x.y.w.z, LocalAddress=x.y.w.z, VPNInstanceName=_xxx_)<190>Jan 13 2023 13:48:30+02:00
 hostname %%01DEBUG/6/DBG_HEALTH(l):CID=0x80cc000d;Automatic record:
<div>###########################################</div>
<div>#Automatic record log end,current health information as follows:</div>
<div><190>Jan 13 2023 13:48:30+02:00 hostname %%01DEBUG/6/DBG_HEALTH(l):CID=xxx;Automatic record:</div>
<div>Slot                CPU Memory(Used/Total)     Physical Memory Usage(Free/Total/Cache)</div>
<div>--------------------------------------------------------------------------------------</div>
<div>1       IPU(Master)  12% 26% 4006MB/15394MB            34%    10123MB/15396MB/2287MB</div>
<div>        CPU0         17%</div>
<div>        CPU1         12%</div>
<div>        CPU2         13%</div>
<div>        CPU3         14%</div>
<div>        CPU4          7%</div>
<div>        CPU5         11%</div>
<div>        ProcessId    CPU</div>
<div>        1019          1%</div>
<div>        1001          3%</div>
<div>        1005          0%</div>
<div>        1015         41%</div>
<div>        1012          0%</div>
<div>        3             1%</div>
<div>        10001         2%</div>
<div>        1006          1%</div>
<div>        1018          0%</div>
<div>        1000          0%</div>
<div>        1013          2%</div>
<div>        1003          1%</div>
<div>        1007          0%</div>
<div>        1010          1%</div>
<div>        1008          1%</div>
<div>        1016         201%</div>
<div>        1017          1%</div>
<div>        1014          0%</div>
<div>        1011          0%</div>
<div> .<190>Jan 13 2023 13:48:30+02:00 hostname %%01DEBUG/6/DBG_HEALTH(l):CID=xxxx;Automatic record:</div>
<div>#DateTime Stamp:2023-01-13 13:48:30.673</div>
###########################################<188>Jan 13 2023 13:49:16+02:00 hostname %%01SNMP/4/SNMP_MIB_SET(s):CID=xxx;MIB node set. (UserName=xxx, SourceIP=x.y.w.z, DestIP=x.y.w.z, Version=v3, RequestId=xxx, hwCfgOperateType.89005=6,hwCfgOperateProtocol.89005=3,hwCfgOperateFileName.89005=[xxx(hex)],hwCfgOperateServerAddress.89005=x.y.w.z,hwCfgOperateUserName.89005=[xxx(hex)],hwCfgOperateUserPassword.89005=******,hwCfgOperateServerPort.89005=xxx,hwCfgOperateRowStatus.89005=xxx,
 VPN=xxx)<188>Jan 13 2023 13:49:17+02:00 hostname %%01CONFIGURATION/4/CONFIGMIB_FILE_OPERATE_FINISH(l):CID=xxx;Configuration was copied. (OperationType=6, OptTime=94, OptState=2, OptEndTime=24674900)...<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Br,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Dragan</div>
<div id="m_7811956561289545828m_4259688082548349749m_-367437977939007214appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_7811956561289545828m_4259688082548349749m_-367437977939007214divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> syslog-ng <<a href="mailto:syslog-ng-bounces@lists.balabit.hu" rel="noreferrer noreferrer noreferrer" target="_blank">syslog-ng-bounces@lists.balabit.hu</a>> on behalf of Evan Rempel <<a href="mailto:erempel@uvic.ca" rel="noreferrer noreferrer noreferrer" target="_blank">erempel@uvic.ca</a>><br>
<b>Sent:</b> Thursday, February 2, 2023 2:07 PM<br>
<b>To:</b> <a href="mailto:syslog-ng@lists.balabit.hu" rel="noreferrer noreferrer noreferrer" target="_blank">syslog-ng@lists.balabit.hu</a> <<a href="mailto:syslog-ng@lists.balabit.hu" rel="noreferrer noreferrer noreferrer" target="_blank">syslog-ng@lists.balabit.hu</a>><br>
<b>Subject:</b> Re: [syslog-ng] Syslog messages not stored in separate lines</font>
<div> </div>
</div>
<div>
<div><br>
</div>
<div>Is there a line break anywhere in the log file?</div>
<div><br>
</div>
<div>If yes</div>
<div><br>
</div>
<div>1. is the line break in the middle of a syslog line from this device?</div>
<div>2. is the line break at the maximum message size?</div>
<div>3. is the line break at the end of a log message from a different device that is logging to the same s_xxx_xxx source?</div>
<div><br>
</div>
<div><br>
</div>
<div>What I am wondering is that the source of the log messages is logging the exact same stream of data to the TCP port that it would have over the UDP port (which would be an error). UDP messages are not terminated with a new line,
 while the TCP messages are. If that were the case then syslog-ng would never see multiple messages, and would write a continuous stream on a single line until it reached the maximum message length, or it logged a correctly terminated message from a different
 device.<br>
</div>
<div><br>
</div>
<div>Evan.<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>On 2023-02-02 05:55, Dragan Zecevic wrote:<br>
</div>
<blockquote type="cite"><br>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hi Balazs,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
this is how the whole config snippet looks like:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
source s_xxx_xxx {
<div>        network(</div>
<div>                ip(0.0.0.0)</div>
<div>                transport(tcp)</div>
<div>                port(xxxx)</div>
<div>                flags(store-raw-message)</div>
<div>        );</div>
<div>};</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>filter filter_xxx_xxx {</div>
<div><br>
</div>
<div>                host("xxx") or host("xxx") ...;</div>
<div>};</div>
<div><br>
</div>
<div><br>
</div>
<div>destination folder_xxx_xxx {</div>
<div><br>
</div>
<div>                file(</div>
<div>                        "/xxx/.../xxx/${R_YEAR}${R_MONTH}${R_DAY}/${SOURCEIP}_${HOST}_${R_HOUR}.log"</div>
<div>                        template("${RAWMSG}\n")</div>
<div>                        dir-group(xxx)</div>
<div>                        dir-perm(xxx)</div>
<div>                        group(xxx)</div>
<div><br>
</div>
<div>                );</div>
<div>};</div>
<div><br>
</div>
<div><br>
</div>
<div>log {</div>
<div>                source(s_xxx_xxx); filter(filter_xxx_xxx); destination(folder_xxx_xxx);</div>
};<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Sorry for the xxx but I can't export real parameters in conversation like this. Also, I can't provide some pcap or tcpdump.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
I restarted syslog-ng multiple times because I also added some other sources and there were no error messages. And this is the only part of the configuration where either this destination or folder are used.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
I hope this info is helpful.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Thanks,
<div>Dragan</div>
</div>
<div>
<div id="m_7811956561289545828m_4259688082548349749m_-367437977939007214x_Signature"><br>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_7811956561289545828m_4259688082548349749m_-367437977939007214x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> syslog-ng
<a href="mailto:syslog-ng-bounces@lists.balabit.hu" rel="noreferrer noreferrer noreferrer" target="_blank">
<syslog-ng-bounces@lists.balabit.hu></a> on behalf of Balazs Scheidler <a href="mailto:bazsi77@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">
<bazsi77@gmail.com></a><br>
<b>Sent:</b> Tuesday, January 31, 2023 9:18 PM<br>
<b>To:</b> Syslog-ng users' and developers' mailing list <a href="mailto:syslog-ng@lists.balabit.hu" rel="noreferrer noreferrer noreferrer" target="_blank">
<syslog-ng@lists.balabit.hu></a><br>
<b>Subject:</b> Re: [syslog-ng] Syslog messages not stored in separate lines</font>
<div> </div>
</div>
<div>
<div dir="auto">
<div>If there's an initialization error with a config at reloading, syslog-ng can fall back to the old one. Can this happen? Or two destinations writing the same file?</div>
<div dir="auto"><br>
</div>
<div dir="auto">If the problem persists, can you create minimal example with complete with config and sample message that you send and which reproduces the issue?</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thanks<br>
<br>
<div dir="auto">
<div dir="ltr">On Tue, Jan 31, 2023, 20:44 Dragan Zecevic <<a href="mailto:dragan.zecevic@live.com" rel="noreferrer noreferrer noreferrer" target="_blank">dragan.zecevic@live.com</a>> wrote:<br>
</div>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Balazs,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
thank you for your reply.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Yes, I used config like this for other sources as well and restarted syslog-ng service.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I don't get it why it doesn't work in this case. I was thinking it is up to the input.</div>
<div id="m_7811956561289545828m_4259688082548349749m_-367437977939007214x_x_m_4134358523529882524Signature"><br>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_7811956561289545828m_4259688082548349749m_-367437977939007214x_x_m_4134358523529882524divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> syslog-ng <<a href="mailto:syslog-ng-bounces@lists.balabit.hu" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">syslog-ng-bounces@lists.balabit.hu</a>>
 on behalf of Balazs Scheidler <<a href="mailto:bazsi77@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">bazsi77@gmail.com</a>><br>
<b>Sent:</b> Monday, January 30, 2023 6:48 AM<br>
<b>To:</b> Syslog-ng users' and developers' mailing list <<a href="mailto:syslog-ng@lists.balabit.hu" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">syslog-ng@lists.balabit.hu</a>><br>
<b>Subject:</b> Re: [syslog-ng] Syslog messages not stored in separate lines</font>
<div> </div>
</div>
<div>
<div dir="auto">
<div>This would be very strange indeed as the template of your file destination includes a newline character at the end of every message, so it should not depend on the input.</div>
<div dir="auto"><br>
</div>
<div dir="auto">You sure that this is the destination config that you quote here? Did you reload syslog-ng to use that config?<br>
<br>
<div dir="auto">
<div dir="ltr">On Sun, Jan 29, 2023, 13:55 Dragan Zecevic <<a href="mailto:dragan.zecevic@live.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">dragan.zecevic@live.com</a>> wrote:<br>
</div>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I am collecting logs from a network device. They configured syslog format on their source side to be RFC3164.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
On syslog-ng side I am using source and destination like this:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
source s_xxx {
<div>        network(</div>
<div>                ip(0.0.0.0)</div>
<div>                transport(tcp)</div>
<div>                port(xxx)</div>
<div>                flags(store-raw-message)</div>
<div>        );</div>
<div>};</div>
<div><br>
</div>
<div><br>
</div>
<div>destination folder_xxx {</div>
<div><br>
</div>
<div>                file(</div>
<div>                        "/xxx/${R_YEAR}${R_MONTH}${R_DAY}/${SOURCEIP}_${HOST}_${R_HOUR}.log"</div>
<div>                        template("${RAWMSG}\n")</div>
<div>                );</div>
};</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
syslog-ng version 3.34</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
CentOS Linux release 7.9.2009</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
The problem is that syslog messages are stored in raw format but not separated in different line. Parity bit of new message starts imidiatelly after previous line -without space or enter.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I have the same config for some other hosts and there log files are created with separate lines. Vendor says they can't change anything on source side.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Do you have any idea what is the cause of this?</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thank you.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Br,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Dragan</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</div>

______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer noreferrer noreferrer 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 noreferrer noreferrer 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 noreferrer noreferrer noreferrer" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
</blockquote></div></div></div>