<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Merge lines from rotated file in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Merge-lines-from-rotated-file/m-p/551253#M91512</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have some difficulties to ingest properly logs from rotated file, where the rotation is fully handled by an application, without any settings about its log files.&lt;/P&gt;&lt;P&gt;In some cases, it rotates the log file in the middle of an event, and before the timestamp.&lt;/P&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;file.log.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Note: there is no new line or carriage return at tne end of the file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;file.log&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I have some events with an additional line in plain text (no brackets), so at first I let the line merger do its job, but for the splitted line between the 2 log files, it does not work as the first line does not contain the timestamp, and it is added to the previous event.&lt;/P&gt;&lt;P&gt;So, I disabled line merging and started to build a line breaker, resulting in this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(?:\[[^]]*\][\r\n]*){24}\[[^]]*\](?:[^\[\]]*)([\r\n]+)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This is because the log line is made of 25 blocks between brackets, and optionally a second line.&lt;/P&gt;&lt;P&gt;It works very good on a test file when the splitted line is in the same file, but once the 2 parts of the line are in different files ... it does not work anymore &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you have any advice on how I could handle that ?&lt;/P&gt;</description>
    <pubDate>Tue, 11 May 2021 15:21:39 GMT</pubDate>
    <dc:creator>chclemence</dc:creator>
    <dc:date>2021-05-11T15:21:39Z</dc:date>
    <item>
      <title>Merge lines from rotated file</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Merge-lines-from-rotated-file/m-p/551253#M91512</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have some difficulties to ingest properly logs from rotated file, where the rotation is fully handled by an application, without any settings about its log files.&lt;/P&gt;&lt;P&gt;In some cases, it rotates the log file in the middle of an event, and before the timestamp.&lt;/P&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;file.log.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Note: there is no new line or carriage return at tne end of the file&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;file.log&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[category][event][reason][host][timestamp]...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I have some events with an additional line in plain text (no brackets), so at first I let the line merger do its job, but for the splitted line between the 2 log files, it does not work as the first line does not contain the timestamp, and it is added to the previous event.&lt;/P&gt;&lt;P&gt;So, I disabled line merging and started to build a line breaker, resulting in this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;(?:\[[^]]*\][\r\n]*){24}\[[^]]*\](?:[^\[\]]*)([\r\n]+)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This is because the log line is made of 25 blocks between brackets, and optionally a second line.&lt;/P&gt;&lt;P&gt;It works very good on a test file when the splitted line is in the same file, but once the 2 parts of the line are in different files ... it does not work anymore &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you have any advice on how I could handle that ?&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 15:21:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Merge-lines-from-rotated-file/m-p/551253#M91512</guid>
      <dc:creator>chclemence</dc:creator>
      <dc:date>2021-05-11T15:21:39Z</dc:date>
    </item>
  </channel>
</rss>

