<?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: Extract field value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-value/m-p/374739#M110138</link>
    <description>&lt;P&gt;If it's json, use spath&lt;/P&gt;

&lt;P&gt;Otherwise you can do something like this:&lt;/P&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_kv_transform]
FORMAT = $1::$2
REGEX = \"([^"]+)\":\"([^"]+)\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_sourcetype]
REPORT-my_sourcetype_kv = my_kv_transform
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should do search-time extractions to get animal=dog and application=someapp&lt;/P&gt;</description>
    <pubDate>Thu, 03 May 2018 10:01:04 GMT</pubDate>
    <dc:creator>althomas</dc:creator>
    <dc:date>2018-05-03T10:01:04Z</dc:date>
    <item>
      <title>Extract field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-value/m-p/374737#M110136</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Could anybody assist with this question - what method is the best to extract to new field value of "animal" key? Should I use &lt;CODE&gt;eval&lt;/CODE&gt; or searchmatch or something else?&lt;/P&gt;

&lt;P&gt;Here is example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[some_date] ..."application":"some_app", "animal":"dog","segment":....
[some_date] ..."application":"some_app", "animal":"cat","segment":....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need this variable to use in stats.&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 09:47:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-value/m-p/374737#M110136</guid>
      <dc:creator>vintik</dc:creator>
      <dc:date>2018-05-03T09:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-value/m-p/374738#M110137</link>
      <description>&lt;P&gt;This should work:&lt;BR /&gt;
&lt;CODE&gt;| rex "\"animal\":\"(?&amp;lt;animal&amp;gt;[^\"]+)\""&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Alternatively, you could try the following to apply key value extractions on your events. Whether this works properly depends on what exactly your full data looks like, but might be worth playing around with.&lt;BR /&gt;
&lt;CODE&gt;| extract pairdelim=",", kvdelim=":"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 09:58:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-value/m-p/374738#M110137</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-05-03T09:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-value/m-p/374739#M110138</link>
      <description>&lt;P&gt;If it's json, use spath&lt;/P&gt;

&lt;P&gt;Otherwise you can do something like this:&lt;/P&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_kv_transform]
FORMAT = $1::$2
REGEX = \"([^"]+)\":\"([^"]+)\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_sourcetype]
REPORT-my_sourcetype_kv = my_kv_transform
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should do search-time extractions to get animal=dog and application=someapp&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 10:01:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-value/m-p/374739#M110138</guid>
      <dc:creator>althomas</dc:creator>
      <dc:date>2018-05-03T10:01:04Z</dc:date>
    </item>
  </channel>
</rss>

