<?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: Context based regex field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167240#M47605</link>
    <description>&lt;P&gt;This is exactly what I wanted thank you very much!&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jun 2015 20:13:59 GMT</pubDate>
    <dc:creator>shrirangphadke</dc:creator>
    <dc:date>2015-06-22T20:13:59Z</dc:date>
    <item>
      <title>Context based regex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167235#M47600</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to extract few fields out of logs but Splunk field extraction is not working in my case.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2015-06-17 13:48:55,689 abc-field [SystemEvent] Time:'June 17, 2015 8:48:55 PM GMT',Severity:'Critical', Event Source:'domain-c0', Code:'301503', Event Message:'Failed to publish abcd configuration version 1408159473758 to cluster domain-c0. Refer logs for details', Module:'abcd something'

2015-06-17 13:48:55,620 abc-xyz-something June 17, 2015 8:48:55 PM GMT INFO SimpleAsyncTaskExecutor-1 SystemEventDaoImpl:124 - [SystemEvent] Time:'June 17, 2015 8:48:55 PM GMT',Severity:'Informational', Event Source:'edge-0', Code:'30101', Event Message:'abcd was booted', Module:'abcd something Appliance'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In above two log snippets I am trying to extract value of the field "Severity".&lt;BR /&gt;
But since the position of field "Severity" in both the logs are different Splunk returns the field such as:&lt;BR /&gt;
 1. Critical&lt;BR /&gt;
 2. June&lt;/P&gt;

&lt;P&gt;Probably it is because Splunk does regex parsing based on position.&lt;/P&gt;

&lt;P&gt;I want to extract the fields based on pre-context and post-context.&lt;BR /&gt;
For example:&lt;BR /&gt;
Pre-context: "Severity:'"&lt;BR /&gt;
Required value&lt;BR /&gt;
Post-context: "', Event"&lt;/P&gt;

&lt;P&gt;I am completely stuck here. Please help. &lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2015 00:55:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167235#M47600</guid>
      <dc:creator>shrirangphadke</dc:creator>
      <dc:date>2015-06-19T00:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Context based regex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167236#M47601</link>
      <description>&lt;P&gt;Assuming these are the only 2 variants, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "^.*?Severity\s*:\s*'?(?&amp;lt;Severity&amp;gt;[^'\s]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jun 2015 01:04:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167236#M47601</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-19T01:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Context based regex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167237#M47602</link>
      <description>&lt;P&gt;Thank you very much for your answer !&lt;BR /&gt;
Now it will take me another day to understand this &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2015 01:13:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167237#M47602</guid>
      <dc:creator>shrirangphadke</dc:creator>
      <dc:date>2015-06-19T01:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Context based regex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167238#M47603</link>
      <description>&lt;P&gt;Is there any Splunk regex tutorial which I can follow ?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2015 01:19:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167238#M47603</guid>
      <dc:creator>shrirangphadke</dc:creator>
      <dc:date>2015-06-19T01:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Context based regex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167239#M47604</link>
      <description>&lt;P&gt;I learned by doing but that's just the way I am.  So although I cannot help you much there, I can suggest some tools.  My favorite is &lt;CODE&gt;Expresso&lt;/CODE&gt; which is free.  I use this almost every day.  It does a good job of "translating" the RegEx to english on the right side so that when somebody gives you a solution (like I did), it will show you bit-by-bit which each part of the RegEx is doing.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2015 01:23:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167239#M47604</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-19T01:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Context based regex field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167240#M47605</link>
      <description>&lt;P&gt;This is exactly what I wanted thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2015 20:13:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Context-based-regex-field-extraction/m-p/167240#M47605</guid>
      <dc:creator>shrirangphadke</dc:creator>
      <dc:date>2015-06-22T20:13:59Z</dc:date>
    </item>
  </channel>
</rss>

