<?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: How to extract key value pairs in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404894#M6341</link>
    <description>&lt;P&gt;Does automatic key=value extraction not work?&lt;/P&gt;</description>
    <pubDate>Thu, 11 Apr 2019 10:33:00 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2019-04-11T10:33:00Z</dc:date>
    <item>
      <title>How to extract key value pairs</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404893#M6340</link>
      <description>&lt;P&gt;input: {author=John, book=Splunk } &lt;/P&gt;

&lt;H2&gt;output table&lt;/H2&gt;

&lt;P&gt;&lt;STRONG&gt;author book&lt;/STRONG&gt;&lt;BR /&gt;
John  Splunk&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 03:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404893#M6340</guid>
      <dc:creator>ts00011</dc:creator>
      <dc:date>2019-04-11T03:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key value pairs</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404894#M6341</link>
      <description>&lt;P&gt;Does automatic key=value extraction not work?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 10:33:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404894#M6341</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2019-04-11T10:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key value pairs</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404895#M6342</link>
      <description>&lt;P&gt;This will extract that information from _raw for any comma seperated key value pairing, which Splunk will do normally without much prompting, but this format is an odd format since it's wrapped in curly brackets like json, but contains a comma seperated key value pair instead of what I would expect from a json string. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| eval _raw="{author=John, book=Splunk }"
| extract kvdelim="=" pairdelim=","
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If your goal is to not have the curly bracket get picked up you can just remove it prior to the extract with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| eval _raw="{author=John, book=Splunk }"
| rex field=_raw mode=sed "s/[\{\}]+//g"
| eval _raw=trim(_raw)
| extract kvdelim="=" pairdelim=","
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 13:00:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404895#M6342</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-04-11T13:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key value pairs</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404896#M6343</link>
      <description>&lt;P&gt;@ts00011 while posting code/data on Splunk Answers make sure to use the &lt;CODE&gt;code button 101010 or shortcut Ctrl+K&lt;/CODE&gt;. This will ensure that special characters will not get escaped. If you have a valid JSON data, you should be able to use either one of &lt;CODE&gt;KV_MODE=json&lt;/CODE&gt; or &lt;CODE&gt;INDEXED_EXTRACTIONS=json&lt;/CODE&gt; turned on for Splunk to do either Search Time Field Extraction or Index Time Field Extraction (but not both, which will create duplicate result at search time), depending on your use case.&lt;/P&gt;

&lt;P&gt;For your example a valid JSON should look like the following (notice colon &lt;CODE&gt;:&lt;/CODE&gt; and double quotes &lt;CODE&gt;"&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"author":"John","book":"Splunk"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere example to show the output of how JSON data field extraction will look like.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval jsonData="{\"author\":\"John\",\"book\":\"Splunk\"}"
| rename jsonData as _raw
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If your data is indeed not valid json and is of the same form as your example, you should still be able to define field extractions (search time) to extract them.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 13:55:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/404896#M6343</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-04-11T13:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key value pairs</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/741101#M10382</link>
      <description>&lt;P&gt;No need for the renaming to _raw&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval jsonData="{\"author\":\"John\",\"book\":\"Splunk\"}"
| spath input=jsonData&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 07 Mar 2025 10:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-to-extract-key-value-pairs/m-p/741101#M10382</guid>
      <dc:creator>jotne</dc:creator>
      <dc:date>2025-03-07T10:05:42Z</dc:date>
    </item>
  </channel>
</rss>

