<?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 Re: Regex to Select Data Between Line Breaks in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413573#M119188</link>
    <description>&lt;P&gt;look at my last edit.... i think you need to name the capture group (my example I named it "event" ). &lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/aRu6NA/1"&gt;https://regex101.com/r/aRu6NA/1&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Apr 2019 21:08:02 GMT</pubDate>
    <dc:creator>robinettdonWY</dc:creator>
    <dc:date>2019-04-11T21:08:02Z</dc:date>
    <item>
      <title>Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413567#M119182</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to create a regex so that I can have all data in between line breaks as one event. Here is a sample of the data I'm working with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;isDraggingObject   : True
id                 : afbbdeb7-9fd4-4b53-ab17-742809154ba9
condition          : {or, matches System.Object[] (?i)(^.*?host failure 
                     alert.*?www\.jennycraig\.com\.au.*?$), matches System.Object[] 
                     (?i)(^.*?\bwarning\b.*?www\.jennycraig\.com\.au.*?$)}
catch_all          : False
advanced_condition : {}
actions            : {route PVG22KK, severity warning}

isDraggingObject   : True
id                 : 3b5aa785-b854-4e43-900a-225da5786a27
condition          : {or, matches System.Object[] 
                     (?i)(^.*?\bcritical\b.*?www\.jennycraig\.com\.au.*?$)}
catch_all          : False
advanced_condition : {}
actions            : {severity critical, route PVG22KK}

**isDraggingObject   : True
id                 : a8420998-fbca-486b-9ff7-d03b9e16536e
condition          : {or, matches System.Object[] (?i)(^.*?\bcritical\b.*?www\.jennycraig\.com$), 
                     matches System.Object[] (?i)(^.*?\bcritical\b.*?locations\.jennycraig\.com)}
catch_all          : False
advanced_condition : {}
actions            : {severity critical, route PW0VV83}**
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The aim is to get all data as one event.&lt;/P&gt;

&lt;P&gt;Thanks in advance for you help. I've been trying multiple different regex expressions, but just can't figure it out...&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 14:10:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413567#M119182</guid>
      <dc:creator>dfrench151</dc:creator>
      <dc:date>2019-04-11T14:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413568#M119183</link>
      <description>&lt;P&gt;Are you saying this data currently in multiple lines and you want to combine it into a single line?  Do you want to do this at index time or search time?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 14:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413568#M119183</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-04-11T14:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413569#M119184</link>
      <description>&lt;P&gt;I want this to be completed at the time I index the date. Even 1 should be:&lt;BR /&gt;
 isDraggingObject   : True&lt;BR /&gt;
 id                 : afbbdeb7-9fd4-4b53-ab17-742809154ba9&lt;BR /&gt;
 condition          : {or, matches System.Object&lt;A href="https://community.splunk.com/?i" target="_blank"&gt;&lt;/A&gt;(^.&lt;EM&gt;?host failure &lt;BR /&gt;
                      alert.&lt;/EM&gt;?&lt;A href="http://www.jennycraig.com.au" target="_blank"&gt;www.jennycraig.com.au&lt;/A&gt;.&lt;EM&gt;?$), matches System.Object&lt;A href="https://community.splunk.com/?i" target="_blank"&gt;&lt;/A&gt;(^.&lt;/EM&gt;?\bwarning\b.&lt;EM&gt;?&lt;A href="http://www.jennycraig.com.au" target="_blank"&gt;www.jennycraig.com.au&lt;/A&gt;.&lt;/EM&gt;?$)}&lt;BR /&gt;
 catch_all          : False&lt;BR /&gt;
 advanced_condition : {}&lt;BR /&gt;
 actions            : {route PVG22KK, severity warning}&lt;/P&gt;

&lt;P&gt;Event 2:&lt;BR /&gt;
 isDraggingObject   : True&lt;BR /&gt;
 id                 : 3b5aa785-b854-4e43-900a-225da5786a27&lt;BR /&gt;
 condition          : {or, matches System.Object&lt;A href="https://community.splunk.com/?i" target="_blank"&gt;&lt;/A&gt;(^.&lt;EM&gt;?\bcritical\b.&lt;/EM&gt;?&lt;A href="http://www.jennycraig.com.au.*?$" target="_blank"&gt;www.jennycraig.com.au.*?$&lt;/A&gt;)}&lt;BR /&gt;
 catch_all          : False&lt;BR /&gt;
 advanced_condition : {}&lt;BR /&gt;
 actions            : {severity critical, route PVG22KK}&lt;/P&gt;

&lt;P&gt;Currently splunk is just grouping everything together into one event.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:08:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413569#M119184</guid>
      <dc:creator>dfrench151</dc:creator>
      <dc:date>2020-09-30T00:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413570#M119185</link>
      <description>&lt;P&gt;Is this logging format some kind of application standard or is this something that someone made in house.  I ask because the way it's currently formatted makes it difficult for index time field extractions.  I have a search time extraction that can be used to accomplish what I believe you are trying to do (create key value pairs) using a run anywhere example with your data that was provided on your question:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=3 
| streamstats count as counter 
| eval _raw=case(counter=1, " isDraggingObject   : True
 id                 : afbbdeb7-9fd4-4b53-ab17-742809154ba9
 condition          : {or, matches System.Object[] (?i)(^.*?host failure 
                      alert.*?www\.jennycraig\.com\.au.*?$), matches System.Object[] 
                      (?i)(^.*?\bwarning\b.*?www\.jennycraig\.com\.au.*?$)}
 catch_all          : False
 advanced_condition : {}
 actions            : {route PVG22KK, severity warning}", counter=2, " isDraggingObject   : True
 id                 : 3b5aa785-b854-4e43-900a-225da5786a27
 condition          : {or, matches System.Object[] 
                      (?i)(^.*?\bcritical\b.*?www\.jennycraig\.com\.au.*?$)}
 catch_all          : False
 advanced_condition : {}
 actions            : {severity critical, route PVG22KK}", counter=3, " **isDraggingObject   : True
 id                 : a8420998-fbca-486b-9ff7-d03b9e16536e
 condition          : {or, matches System.Object[] (?i)(^.*?\bcritical\b.*?www\.jennycraig\.com$), 
                      matches System.Object[] (?i)(^.*?\bcritical\b.*?locations\.jennycraig\.com)}
 catch_all          : False
 advanced_condition : {}
 actions            : {severity critical, route PW0VV83}**") 
| fields - counter _time 
| rex field=_raw mode=sed "s/(\n|^)\s+(\w+\s+):/█\1\2:/g" 
| makemv _raw delim="█" 
| rex mode=sed field=_raw "s/█//g"
| rex mode=sed field=_raw "s/\n/ /g"
| extract kvdelim=":" pairdelim="
"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first sed statement is placing a unique character to be inserted into the event, which we can then use to make it a multi-valued results that splits each key value pairing into a unique value of the raw data.  It then removes the unique character and then removes all line breaks and makes them spaces.  After that is done you can run the extract command and it will produce proper key value pairing.&lt;/P&gt;

&lt;P&gt;If this is a custom generated log event, I would suggest that they consider making it key value format by wrapping their values with quotes and changing the colon to an equal sign or follow the Windows events formatting standard if you want line breaks without quotes in your values.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 18:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413570#M119185</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-04-11T18:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413571#M119186</link>
      <description>&lt;P&gt;Assuming you want everything in between the empty lines in 1 capture group (named "event")... this should work. &lt;/P&gt;

&lt;P&gt;edit: sorry for cut and paste silliness. &lt;BR /&gt;
&lt;CODE&gt;(?&amp;lt;event&amp;gt;^.\S*[^\n&amp;lt;]*(?:(?:&amp;lt;(?!)|\n(?!$))[^\n]*)*(?:|\n$|\z))&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/aRu6NA/1"&gt;Demo&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:20:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413571#M119186</guid>
      <dc:creator>robinettdonWY</dc:creator>
      <dc:date>2019-04-11T20:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413572#M119187</link>
      <description>&lt;P&gt;So would this be in the props.conf file?&lt;BR /&gt;
LINE_BREAKER = (?^.\S*&lt;A href="https://community.splunk.com/?:(?:%3C(?!)%7Cn(?!$))%5B%5En%5D" target="_blank"&gt;^\n&amp;lt;&lt;/A&gt;*(?:|\n$|\z))&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:08:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413572#M119187</guid>
      <dc:creator>dfrench151</dc:creator>
      <dc:date>2020-09-30T00:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413573#M119188</link>
      <description>&lt;P&gt;look at my last edit.... i think you need to name the capture group (my example I named it "event" ). &lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/aRu6NA/1"&gt;https://regex101.com/r/aRu6NA/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:08:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413573#M119188</guid>
      <dc:creator>robinettdonWY</dc:creator>
      <dc:date>2019-04-11T21:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413574#M119189</link>
      <description>&lt;P&gt;The document is created from a powershell script that pulls data through an API connection with an online application. When the information is indexed, there are not line breaks...:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;isDraggingObject   : True
id                 : afbbdeb7-9fd4-4b53-ab17-742809154ba9
condition          : {or, matches System.Object[] (?i)(^.*?host failure alert.*?www\.jennycraig\.com\.au.*?$), matches 
                     System.Object[] (?i)(^.*?\bwarning\b.*?www\.jennycraig\.com\.au.*?$)}
catch_all          : False
advanced_condition : {}
actions            : {route PVG22KK, severity warning}
isDraggingObject   : True
id                 : 3b5aa785-b854-4e43-900a-225da5786a27
condition          : {or, matches System.Object[] (?i)(^.*?\bcritical\b.*?www\.jennycraig\.com\.au.*?$)}
catch_all          : False
advanced_condition : {}
actions            : {severity critical, route PVG22KK}
isDraggingObject   : True
id                 : a8420998-fbca-486b-9ff7-d03b9e16536e
condition          : {or, matches System.Object[] (?i)(^.*?\bcritical\b.*?www\.jennycraig\.com$), matches 
                     System.Object[] (?i)(^.*?\bcritical\b.*?locations\.jennycraig\.com)}
catch_all          : False
advanced_condition : {}
actions            : {severity critical, route PW0VV83}
isDraggingObject   : True
id                 : d9837013-68c9-42bf-a91f-8dd8a94ca377
condition          : {or, matches System.Object[] (?i)(^.*?host failure alert.*?www\.jennycraig\.com$), matches 
                     System.Object[] (?i)(^.*?\bwarning\b.*?www\.jennycraig\.com$), matches System.Object[] 
                     (?i)(^.*?host failure alert.*?locations\.jennycraig\.com)...}
catch_all          : False
advanced_condition : {}
actions            : {route PW0VV83, severity warning}
isDraggingObject   : True
id                 : 20fc7d82-d17d-443e-9802-c8f2df462ce9
condition          : {or, equals System.Object[] critical: Page Failure alert on 
                     &lt;A href="https://uw2pobi11.sonic.jennycraig.com:9503/analytics" target="test_blank"&gt;https://uw2pobi11.sonic.jennycraig.com:9503/analytics&lt;/A&gt;, equals System.Object[] critical: Page 
                     Failure alert on &lt;A href="https://uw2pobi11.sonic.jennycraig.com:9501/console" target="test_blank"&gt;https://uw2pobi11.sonic.jennycraig.com:9501/console&lt;/A&gt;, equals System.Object[] 
                     critical: Page Failure alert on &lt;A href="https://uw2pobi11.sonic.jennycraig.com:9501/em...}" target="test_blank"&gt;https://uw2pobi11.sonic.jennycraig.com:9501/em...}&lt;/A&gt;
catch_all          : False
advanced_condition : {}
actions            : {route PO77HX2}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried out your code in one of the searches and it produced no results.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:56:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413574#M119189</guid>
      <dc:creator>dfrench151</dc:creator>
      <dc:date>2019-04-11T21:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413575#M119190</link>
      <description>&lt;P&gt;I tried that example as well and for some reason it is still combining all the data into one event.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413575#M119190</guid>
      <dc:creator>dfrench151</dc:creator>
      <dc:date>2019-04-11T21:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to Select Data Between Line Breaks</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413576#M119191</link>
      <description>&lt;P&gt;Your description is strange to me.  If you mean that there is a blank line between events, then this will do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[&amp;lt;YourSourcetypeHere&amp;gt;]
SHOULD_LINEMERGE = false
LINEBREAKER = ([\r\n]\s*[\r\n]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2019 00:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-Select-Data-Between-Line-Breaks/m-p/413576#M119191</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-12T00:03:59Z</dc:date>
    </item>
  </channel>
</rss>

