<?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: multi-line extract help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/multi-line-extract-help/m-p/38249#M8684</link>
    <description>&lt;P&gt;It really shouldn't matter what line Enterprise is followed by if you write a regex properly.&lt;/P&gt;

&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;
[\r\n]\s*Enterprise:\s*(?P&amp;lt;enterprise&amp;gt;[^\r\n]*)(?:[\r\n]|$)
&lt;/PRE&gt;

&lt;P&gt;I just tested the regex with a regex tool, not splunk; so if for whatever reason the above doesn't work, try this this one instead.  This option enabled the regex "multiline" mode.&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
 (?m)^\s*Enterprise:\s*(?P&amp;lt;enterprise&amp;gt;.*)$&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 11:44:54 GMT</pubDate>
    <dc:creator>Lowell</dc:creator>
    <dc:date>2020-09-28T11:44:54Z</dc:date>
    <item>
      <title>multi-line extract help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-line-extract-help/m-p/38248#M8683</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm having issues with extracting a field from multi-line events. Two samples are below. I want to grab the value of "Enterprise:". In most events, the Enterprise line is followed by "Object:", but in other events, it is the last line of the event. I am unable to extract the field properly in both scenarios. I tried the IFX, which tested ok, but when I actually ran a search against it, didn't work - it grabs everything after Enterprise, including all the "Object" stuff. &lt;/P&gt;

&lt;P&gt;Any ideas? Also, keep in mind that the length of Enterprise will vary.&lt;/P&gt;

&lt;P&gt;Trap Type: Authentication Failure&lt;BR /&gt;
        Specific Type: 0&lt;BR /&gt;
        Enterprise: 1.3.6.1.4.1.564.101.1&lt;/P&gt;

&lt;P&gt;Trap Type: Vendor Specific&lt;BR /&gt;
        Specific Type: 1085&lt;BR /&gt;
        Enterprise: 1.3.6.1.4.1.3167.1.2.8&lt;BR /&gt;
        Object:1.3.6.1.4.1.3167.1.1.1 Value:3&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2012 15:12:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-line-extract-help/m-p/38248#M8683</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2012-04-27T15:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: multi-line extract help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-line-extract-help/m-p/38249#M8684</link>
      <description>&lt;P&gt;It really shouldn't matter what line Enterprise is followed by if you write a regex properly.&lt;/P&gt;

&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;
[\r\n]\s*Enterprise:\s*(?P&amp;lt;enterprise&amp;gt;[^\r\n]*)(?:[\r\n]|$)
&lt;/PRE&gt;

&lt;P&gt;I just tested the regex with a regex tool, not splunk; so if for whatever reason the above doesn't work, try this this one instead.  This option enabled the regex "multiline" mode.&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
 (?m)^\s*Enterprise:\s*(?P&amp;lt;enterprise&amp;gt;.*)$&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:44:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-line-extract-help/m-p/38249#M8684</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2020-09-28T11:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: multi-line extract help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-line-extract-help/m-p/38250#M8685</link>
      <description>&lt;P&gt;Thanks. Looks like the first one worked - second did not.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2012 17:12:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-line-extract-help/m-p/38250#M8685</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2012-04-27T17:12:36Z</dc:date>
    </item>
  </channel>
</rss>

