<?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: Field Extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491337#M137164</link>
    <description>&lt;P&gt;yes, there are several ways to solve the same problem but the idea behind it to use &lt;CODE&gt;Positive Lookahead and Quantifier&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;you could also try &lt;CODE&gt;error\s+message\s+(?&amp;lt;Message&amp;gt;.+(?=(\:\s+message\s+\:)))&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2019 18:36:07 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2019-11-19T18:36:07Z</dc:date>
    <item>
      <title>Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491333#M137160</link>
      <description>&lt;P&gt;Hi All, I want to extract the log to be extracted from &lt;STRONG&gt;error message&lt;/STRONG&gt; till &lt;STRONG&gt;: message :&lt;/STRONG&gt; , but not getting it, I have tried few queries but I am not getting the desired output:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;error message&lt;/STRONG&gt; System.Net.Http.HttpRequestException: An error occurred while sending the request. ---&amp;gt; System.Net.WebException: The remote name could not be resolved: TimeoutChecklistExecutionResultHandler.cs:line 293 &lt;STRONG&gt;: message :&lt;/STRONG&gt; {&lt;BR /&gt;
Please suggest what query should I choose.&lt;BR /&gt;
PS: | rex ".(Asterisk)error message (?.(Asterisk)) : message : .*" is not working&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 15:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491333#M137160</guid>
      <dc:creator>shivam_j</dc:creator>
      <dc:date>2019-11-19T15:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491334#M137161</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
|  eval _raw="error message System.Net.Http.HttpRequestException: An error occurred while sending the request. ---&amp;gt; System.Net.WebException: The remote name could not be resolved: TimeoutChecklistExecutionResultHandler.cs:line 293 : message : {" 
|  rex  "error\s+message\s+(?&amp;lt;Message&amp;gt;.+?(?=(\:\s+message\s+\:)))"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Nov 2019 17:52:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491334#M137161</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-19T17:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491335#M137162</link>
      <description>&lt;P&gt;Try the below query&lt;BR /&gt;
error message .*(?=(: message :))&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 17:52:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491335#M137162</guid>
      <dc:creator>uagrawal_splunk</dc:creator>
      <dc:date>2019-11-19T17:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491336#M137163</link>
      <description>&lt;P&gt;I tried the query in regex101 and it takes 650 steps to match the regex. And the same query with little modification takes the 78 steps to match the regex. Here is the query:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;error\s+message\s+(?&amp;lt;Message&amp;gt;.*(?=(\:\s+message\s+\:)))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 18:10:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491336#M137163</guid>
      <dc:creator>uagrawal_splunk</dc:creator>
      <dc:date>2019-11-19T18:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491337#M137164</link>
      <description>&lt;P&gt;yes, there are several ways to solve the same problem but the idea behind it to use &lt;CODE&gt;Positive Lookahead and Quantifier&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;you could also try &lt;CODE&gt;error\s+message\s+(?&amp;lt;Message&amp;gt;.+(?=(\:\s+message\s+\:)))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 18:36:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491337#M137164</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-19T18:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491338#M137165</link>
      <description>&lt;P&gt;Hi Try this &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex field=_raw  "error\smessage\s(?P&amp;lt;ErrorMessage&amp;gt;.*)\s:\smessage\s" | table ErrorMessage&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 18:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491338#M137165</guid>
      <dc:creator>Anantha123</dc:creator>
      <dc:date>2019-11-19T18:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491339#M137166</link>
      <description>&lt;P&gt;Hi Shivam,&lt;/P&gt;

&lt;P&gt;We could use regexes to extract the required values.&lt;BR /&gt;
All the answers given above will give the desired results.However, it is advisable to achieve in minimum steps and minimum latency.&lt;BR /&gt;
Otherwise it will have an impact on performance.&lt;/P&gt;

&lt;P&gt;You could check your regex in &lt;STRONG&gt;&lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/STRONG&gt; and look on the top middle to see the no of steps iterated and time consumed.&lt;BR /&gt;
Its better  not to include too much identifier for matching, as it will impact the performance.&lt;/P&gt;

&lt;P&gt;I would suggest to go with the below regex  which only took 46 steps- considering the key identifiers to be the words &lt;STRONG&gt;error message&lt;/STRONG&gt; and &lt;STRONG&gt;message&lt;/STRONG&gt;.&lt;BR /&gt;
Your overall query becomes .&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|Your_search
|rex field = _raw  "error\smessage(?P&amp;lt;exception_message&amp;gt;.*)message"
| table exception_message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please accept and upvote the answer if this helped you.&lt;BR /&gt;
Happy Splunking!!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491339#M137166</guid>
      <dc:creator>dindu</dc:creator>
      <dc:date>2019-11-19T20:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491340#M137167</link>
      <description>&lt;P&gt;Hi Dindu, unfortunately, the log already contains 'message' keyword in between (which i skipped in the log i mentioned in the que. otherwise it would get long). So, this won't work. Thanks for the answer bdw.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 07:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction/m-p/491340#M137167</guid>
      <dc:creator>shivam_j</dc:creator>
      <dc:date>2019-11-20T07:51:38Z</dc:date>
    </item>
  </channel>
</rss>

