<?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 Regex not working for multiline events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443087#M125735</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My logs look like this ...&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;AS RAW TEXT:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"timestamp":"2019-08-08 10:23:38.320","level":"INFO","thread":"task-scheduler-8","mdc":{"TraceabilityID":"abcde","file_name":"MySampleFileName.json","Source":"SOURCE"},"logger":"MyApplicationLogConfig","message":" |IN001 |1010908 |Order placed Successfully. |\n |IN002 |1010909 |Order placed Successfully. |\n"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;SYNTAX HIGHLIGHTED:&lt;/STRONG&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7491i2AE4DFAD599227AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;WHAT I NEED:&lt;/STRONG&gt;&lt;BR /&gt;
1010908, 1010909 extracted as the OrderNum, Order placed Successfully as OrderStatus.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;REGEX:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=message "(\n\s)*\|IN\d+\s\|(?&amp;lt;orderNum&amp;gt;\d+)\s\|(?&amp;lt;orderStatus&amp;gt;[\w\s]+)\.\s\|(\n)?"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;ERROR IS:&lt;/STRONG&gt;&lt;BR /&gt;
The regex extracts only '1010908' as the OrderNum. I want both 1010908, 1010909 to be extracted.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Sun, 11 Aug 2019 15:12:02 GMT</pubDate>
    <dc:creator>namrithadeepak</dc:creator>
    <dc:date>2019-08-11T15:12:02Z</dc:date>
    <item>
      <title>Regex not working for multiline events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443087#M125735</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My logs look like this ...&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;AS RAW TEXT:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"timestamp":"2019-08-08 10:23:38.320","level":"INFO","thread":"task-scheduler-8","mdc":{"TraceabilityID":"abcde","file_name":"MySampleFileName.json","Source":"SOURCE"},"logger":"MyApplicationLogConfig","message":" |IN001 |1010908 |Order placed Successfully. |\n |IN002 |1010909 |Order placed Successfully. |\n"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;SYNTAX HIGHLIGHTED:&lt;/STRONG&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7491i2AE4DFAD599227AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;WHAT I NEED:&lt;/STRONG&gt;&lt;BR /&gt;
1010908, 1010909 extracted as the OrderNum, Order placed Successfully as OrderStatus.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;REGEX:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=message "(\n\s)*\|IN\d+\s\|(?&amp;lt;orderNum&amp;gt;\d+)\s\|(?&amp;lt;orderStatus&amp;gt;[\w\s]+)\.\s\|(\n)?"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;ERROR IS:&lt;/STRONG&gt;&lt;BR /&gt;
The regex extracts only '1010908' as the OrderNum. I want both 1010908, 1010909 to be extracted.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 15:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443087#M125735</guid>
      <dc:creator>namrithadeepak</dc:creator>
      <dc:date>2019-08-11T15:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not working for multiline events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443088#M125736</link>
      <description>&lt;P&gt;can you paste the event as text , without a screen shot? that way we can work with the extraction&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 15:17:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443088#M125736</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-11T15:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not working for multiline events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443089#M125737</link>
      <description>&lt;P&gt;if you just append a max_match=0 , liker this to your regex, is it what you expect?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=message "(\n\s)*\|IN\d+\s\|(?&amp;lt;orderNum&amp;gt;\d+)\s\|(?&amp;lt;orderStatus&amp;gt;[\w\s]+)\.\s\|(\n)?" max_match=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Aug 2019 15:46:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443089#M125737</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-08-11T15:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not working for multiline events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443090#M125738</link>
      <description>&lt;P&gt;You need &lt;CODE&gt;max_match=0&lt;/CODE&gt;, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw = "{\"timestamp\":\"2019-08-08 10:23:38.320\",\"level\":\"INFO\",\"thread\":\"task-scheduler-8\",\"mdc\":{\"TraceabilityID\":\"abcde\",\"file_name\":\"MySampleFileName.json\",\"Source\":\"SOURCE\"},\"logger\":\"MyApplicationLogConfig\",\"message\":\" |IN001 |1010908 |Order placed Successfully. |\n |IN002 |1010909 |Order placed Successfully. |\n\"}"
| spath
| rex field=message max_match=0 "(\n\s)*\|IN\d+\s\|(?&amp;lt;orderNum&amp;gt;\d+)\s\|(?&amp;lt;orderStatus&amp;gt;[\w\s]+)\.\s\|(\n)?"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Aug 2019 20:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-not-working-for-multiline-events/m-p/443090#M125738</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-11T20:27:52Z</dc:date>
    </item>
  </channel>
</rss>

