<?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 How do I parse a key value field in Splunk and search based on values of that field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-parse-a-key-value-field-in-Splunk-and-search-based-on/m-p/368835#M108708</link>
    <description>&lt;P&gt;I have a log as follows&lt;BR /&gt;
  &lt;CODE&gt;&lt;BR /&gt;
14AUG2017_12:54:44.903 3418:13 INFO filename.cpp:200 ID:abc123 contextInfo: [ peer_service: someservice ] object: [ prop1:SOMETHING, prop2:SOMETHING2, prop3:someInt ] otherInfo: [ numEvents:1, dates:[ 01AUG2017 - 01AUG2017 ] otherInfo: [ someOtherInfo:23, someMoreOtherInfo:MID ]  ]&lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
How would I extract the "numEvents" field and query based on it. For example, numFields &amp;gt; 10. I intend to eventually extract all the fields and make a dashboard but in order to do that I have to understand how the field extraction works.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Aug 2017 17:06:43 GMT</pubDate>
    <dc:creator>gb0143</dc:creator>
    <dc:date>2017-08-14T17:06:43Z</dc:date>
    <item>
      <title>How do I parse a key value field in Splunk and search based on values of that field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-parse-a-key-value-field-in-Splunk-and-search-based-on/m-p/368835#M108708</link>
      <description>&lt;P&gt;I have a log as follows&lt;BR /&gt;
  &lt;CODE&gt;&lt;BR /&gt;
14AUG2017_12:54:44.903 3418:13 INFO filename.cpp:200 ID:abc123 contextInfo: [ peer_service: someservice ] object: [ prop1:SOMETHING, prop2:SOMETHING2, prop3:someInt ] otherInfo: [ numEvents:1, dates:[ 01AUG2017 - 01AUG2017 ] otherInfo: [ someOtherInfo:23, someMoreOtherInfo:MID ]  ]&lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
How would I extract the "numEvents" field and query based on it. For example, numFields &amp;gt; 10. I intend to eventually extract all the fields and make a dashboard but in order to do that I have to understand how the field extraction works.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 17:06:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-parse-a-key-value-field-in-Splunk-and-search-based-on/m-p/368835#M108708</guid>
      <dc:creator>gb0143</dc:creator>
      <dc:date>2017-08-14T17:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I parse a key value field in Splunk and search based on values of that field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-parse-a-key-value-field-in-Splunk-and-search-based-on/m-p/368836#M108709</link>
      <description>&lt;P&gt;You can add following search time field extraction (using transforms) on your search head(s).&lt;/P&gt;

&lt;P&gt;props.conf (on search head)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourceTypeGoesHere]
REPORT-extractFields = colon_separated_fields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf(on search head)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[colon_separated_fields]
REGEX = (\w+)\:([^,\s]+)
FORMAT = $1:$2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should extract your fields which are separated by colon, which  you can use in the base search to filter (&lt;CODE&gt;index=foo sourucetype=YourSourcetype numEvents&amp;gt;0&lt;/CODE&gt;)&lt;/P&gt;

&lt;P&gt;If you want to do it inline in the search, do like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourucetype=YourSourcetype |  extract pairdelim="," kvdelim=":" | where numEvents&amp;gt;0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Aug 2017 17:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-parse-a-key-value-field-in-Splunk-and-search-based-on/m-p/368836#M108709</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-08-14T17:22:07Z</dc:date>
    </item>
  </channel>
</rss>

