<?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 Line break with multiple  Linebreaker in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400335#M71312</link>
    <description>&lt;P&gt;I have a log file something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PStart  bla bla bla bla 
PQL% bla bla bla bla
PEnd bla bla bla bla 
PQL% bla bla bla bla
bla bla blabla bla bla
PQL% bla bla bla bla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to break it at PStart or PQL% but if PQL% is within PStart and PEnd keep it one event.&lt;/P&gt;

&lt;P&gt;For the above example, I want to have 3 events as follow&lt;/P&gt;

&lt;P&gt;Event 1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PStart  bla bla bla bla 
PQL% bla bla bla bla
PEnd bla bla bla bla 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 2 &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PQL% bla bla bla bla
bla bla blabla bla bla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 3&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PQL% bla bla bla bla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The code I have is following which doesn't work properly&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
LINE_BREAKER = ([\r\n]+)(?:(?:PStart|(?:PQL%))) 
MUST_NOT_BREAK_BEFORE = ([\r\n]+)(?:PEnd) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 05 Apr 2019 17:51:34 GMT</pubDate>
    <dc:creator>ss026381</dc:creator>
    <dc:date>2019-04-05T17:51:34Z</dc:date>
    <item>
      <title>Line break with multiple  Linebreaker</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400335#M71312</link>
      <description>&lt;P&gt;I have a log file something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PStart  bla bla bla bla 
PQL% bla bla bla bla
PEnd bla bla bla bla 
PQL% bla bla bla bla
bla bla blabla bla bla
PQL% bla bla bla bla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to break it at PStart or PQL% but if PQL% is within PStart and PEnd keep it one event.&lt;/P&gt;

&lt;P&gt;For the above example, I want to have 3 events as follow&lt;/P&gt;

&lt;P&gt;Event 1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PStart  bla bla bla bla 
PQL% bla bla bla bla
PEnd bla bla bla bla 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 2 &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PQL% bla bla bla bla
bla bla blabla bla bla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 3&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;PQL% bla bla bla bla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The code I have is following which doesn't work properly&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
LINE_BREAKER = ([\r\n]+)(?:(?:PStart|(?:PQL%))) 
MUST_NOT_BREAK_BEFORE = ([\r\n]+)(?:PEnd) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2019 17:51:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400335#M71312</guid>
      <dc:creator>ss026381</dc:creator>
      <dc:date>2019-04-05T17:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Line break with multiple  Linebreaker</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400336#M71313</link>
      <description>&lt;P&gt;This is a tough one.  I am curious to see if there is a splunk-based solution.  I've got nothing because negative-lookbehinds must be fixed-length.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 14:29:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400336#M71313</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-07T14:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Line break with multiple  Linebreaker</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400337#M71314</link>
      <description>&lt;P&gt;With the sample as given this is what I come up with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
LINE_BREAKER=([\r\n]+)(?:PStart|PEnd|PQL%)
SHOULD_LINEMERGE=true
BREAK_ONLY_BEFORE=^PStart|^PQL%
MUST_NOT_BREAK_AFTER=^PStart
MUST_BREAK_AFTER=^PEnd
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First during the line breaking stage, we break up into "lines" that start PStart, PEnd or PQL% (This is only necessary if a PEnd line may contain carrage returns or line feeds, otherwise you can get away with the default &lt;CODE&gt;([\r\n]+)&lt;/CODE&gt; here&lt;/P&gt;

&lt;P&gt;Then during line merging, we only break events before a PStart or PQL% line... this gets us our rough separation of events... but then with the MUST_NOT_BREAK_AFTER / MUST_BREAK_AFTER combination, we can ensure that from PStart to PEnd is a single block. (Obviously does not support embedding, but works single level).&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:03:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400337#M71314</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2020-09-30T00:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Line break with multiple  Linebreaker</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400338#M71315</link>
      <description>&lt;P&gt;This works, thanks...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 13:02:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400338#M71315</guid>
      <dc:creator>ss026381</dc:creator>
      <dc:date>2019-04-08T13:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Line break with multiple  Linebreaker</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400339#M71316</link>
      <description>&lt;P&gt;Be sure to click &lt;CODE&gt;Accept&lt;/CODE&gt; to close this question and reward the author of this MOST TERRIBLY EXCELLENT ANSWER!!!!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 14:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400339#M71316</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-08T14:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Line break with multiple  Linebreaker</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400340#M71317</link>
      <description>&lt;P&gt;Thank you guys, I accepted, special thanks to Charlie. &lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 15:00:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Line-break-with-multiple-Linebreaker/m-p/400340#M71317</guid>
      <dc:creator>ss026381</dc:creator>
      <dc:date>2019-04-08T15:00:01Z</dc:date>
    </item>
  </channel>
</rss>

