<?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 to extract the key value pairs? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173865#M16729</link>
    <description>&lt;P&gt;Below is an example of my event:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Timestamp="05/18/14 11:25:16 AM PDT" SessionIndex="2" Action="STATSDAILY" Version="2.1.10" Platform="Android" Device="HTC  One" Params="{coinsEarned : 1800,coinsSpent : 1100,experienceEarned : 2460,timeSpent : 4417,diamondsEarned : 3,diamondsSpent : 18,noOfSessions : 4,energySpent : 7,gamesCompleted : 5}"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;In the above event, in the field "Params", I need to extract the keys as the fields and their values as values for the new fields. So a new field "coinsEarned" should be extracted and its value should be "1800" for this event. Similarly for all the key-value pairs in the field Params. &lt;/P&gt;

&lt;P&gt;Can someone help me with the regular expression to get the desired results?&lt;/P&gt;</description>
    <pubDate>Wed, 21 May 2014 13:26:01 GMT</pubDate>
    <dc:creator>santhgates</dc:creator>
    <dc:date>2014-05-21T13:26:01Z</dc:date>
    <item>
      <title>How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173865#M16729</link>
      <description>&lt;P&gt;Below is an example of my event:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Timestamp="05/18/14 11:25:16 AM PDT" SessionIndex="2" Action="STATSDAILY" Version="2.1.10" Platform="Android" Device="HTC  One" Params="{coinsEarned : 1800,coinsSpent : 1100,experienceEarned : 2460,timeSpent : 4417,diamondsEarned : 3,diamondsSpent : 18,noOfSessions : 4,energySpent : 7,gamesCompleted : 5}"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;In the above event, in the field "Params", I need to extract the keys as the fields and their values as values for the new fields. So a new field "coinsEarned" should be extracted and its value should be "1800" for this event. Similarly for all the key-value pairs in the field Params. &lt;/P&gt;

&lt;P&gt;Can someone help me with the regular expression to get the desired results?&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2014 13:26:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173865#M16729</guid>
      <dc:creator>santhgates</dc:creator>
      <dc:date>2014-05-21T13:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173866#M16730</link>
      <description>&lt;P&gt;You can just add this to your search:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| extract pairdelim="\"{,}" kvdelim=":"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2014 14:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173866#M16730</guid>
      <dc:creator>jameshgibson</dc:creator>
      <dc:date>2014-05-21T14:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173867#M16731</link>
      <description>&lt;P&gt;Perfect! You saved my day &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2014 15:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173867#M16731</guid>
      <dc:creator>santhgates</dc:creator>
      <dc:date>2014-05-21T15:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173868#M16732</link>
      <description>&lt;P&gt;I have a similar situation and this answer doesn't work for me. How does the &lt;CODE&gt;extract&lt;/CODE&gt; command know to work on the &lt;CODE&gt;Params&lt;/CODE&gt; field? It's not mentioned anywhere&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 06:39:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173868#M16732</guid>
      <dc:creator>yonmost</dc:creator>
      <dc:date>2016-09-28T06:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173869#M16733</link>
      <description>&lt;P&gt;Here is what worked for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makemv tokenizer="([^,]+)," Params | mvexpand line
| rex field=Params "(?&amp;lt;key&amp;gt;[^{:]+) : (?&amp;lt;value&amp;gt;[0-9]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Sep 2016 07:50:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173869#M16733</guid>
      <dc:creator>yonmost</dc:creator>
      <dc:date>2016-09-28T07:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173870#M16734</link>
      <description>&lt;P&gt;How to extract something like all the key-value pairs in the field Params ?&lt;/P&gt;

&lt;P&gt;Timestamp="05/18/14 11:25:16 AM PDT" SessionIndex="2" Action="STATSDAILY" Version="2.1.10" Platform="Android" Device="HTC One" Params={"coinsEarned":"1800","coinsSpent":"no coins spent","experienceEarned":"2460","timeSpent":"4417","}&lt;/P&gt;

&lt;P&gt;I've tried this but no luck&lt;/P&gt;

&lt;P&gt;...| extract pairdelim="\"{,}" kvdelim=":"&lt;/P&gt;

&lt;P&gt;Thank in advance&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 23:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/173870#M16734</guid>
      <dc:creator>bnikhil0584</dc:creator>
      <dc:date>2018-04-11T23:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/561127#M66179</link>
      <description>&lt;P&gt;I used the following to help with this at search time with key-value pairs that had space delimiters and = key delimiters:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| extract pairdelim=" " kvdelim="="&lt;/LI-CODE&gt;&lt;P&gt;This also works when your KV pairs optionally have quotation marks for data that contains whitespace.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 00:19:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/561127#M66179</guid>
      <dc:creator>haraksin</dc:creator>
      <dc:date>2021-07-28T00:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the key value pairs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/745136#M81865</link>
      <description>&lt;P&gt;As a matter of fact, one actually doesn't need to specify the field name, which contains all the key value pair.&lt;BR /&gt;I used following simple extract parameters:&lt;BR /&gt;&lt;BR /&gt;| extract pairdelim="," kvdelim=":"&lt;BR /&gt;&lt;BR /&gt;One doesn't need to escape "," as done in the first answer!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 02:11:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-extract-the-key-value-pairs/m-p/745136#M81865</guid>
      <dc:creator>mverma</dc:creator>
      <dc:date>2025-04-29T02:11:36Z</dc:date>
    </item>
  </channel>
</rss>

