<?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 Extract key value pair from xml in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131906#M7774</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have an interesting problem. I have an xml which has  a certain number of key value pairs which I need to extract it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;record&amp;gt;
    &amp;lt;from&amp;gt;customerservice&amp;lt;/from&amp;gt;
    &amp;lt;customer&amp;gt;Dan&amp;lt;/customer&amp;gt;
    &amp;lt;heading&amp;gt;Reminder&amp;lt;/heading&amp;gt;
    &amp;lt;body&amp;gt;Payment Overdue.Amount=176.Discount=16.Pay=160&amp;lt;/body&amp;gt;
&amp;lt;/record&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to extract the following key value pairs &lt;BR /&gt;
Amount=176.Amount=16.Pay=160&lt;/P&gt;

&lt;P&gt;And turn them into a following table&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;customer | Amount | Amount | Pay
------------------------------
Dan      | 176    | 16     | 160 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I do it ?&lt;/P&gt;

&lt;P&gt;Appreciate your help.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;kk&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2013 04:08:31 GMT</pubDate>
    <dc:creator>KarunK</dc:creator>
    <dc:date>2013-11-07T04:08:31Z</dc:date>
    <item>
      <title>Extract key value pair from xml</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131906#M7774</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have an interesting problem. I have an xml which has  a certain number of key value pairs which I need to extract it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;record&amp;gt;
    &amp;lt;from&amp;gt;customerservice&amp;lt;/from&amp;gt;
    &amp;lt;customer&amp;gt;Dan&amp;lt;/customer&amp;gt;
    &amp;lt;heading&amp;gt;Reminder&amp;lt;/heading&amp;gt;
    &amp;lt;body&amp;gt;Payment Overdue.Amount=176.Discount=16.Pay=160&amp;lt;/body&amp;gt;
&amp;lt;/record&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to extract the following key value pairs &lt;BR /&gt;
Amount=176.Amount=16.Pay=160&lt;/P&gt;

&lt;P&gt;And turn them into a following table&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;customer | Amount | Amount | Pay
------------------------------
Dan      | 176    | 16     | 160 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I do it ?&lt;/P&gt;

&lt;P&gt;Appreciate your help.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;kk&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2013 04:08:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131906#M7774</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2013-11-07T04:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key value pair from xml</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131907#M7775</link>
      <description>&lt;P&gt;You can use xmllv&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/xmlkv"&gt;xmlkv link&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If that doesn't work for you, &lt;CODE&gt;| rex field=_raw "Amount\=(?&amp;lt;amount&amp;gt;\d+)\.Discount\=(?&amp;lt;discount&amp;gt;\d+)\.Pay\=(?&amp;lt;pay&amp;gt;\d+)"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2013 04:14:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131907#M7775</guid>
      <dc:creator>ShaneNewman</dc:creator>
      <dc:date>2013-11-07T04:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key value pair from xml</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131908#M7776</link>
      <description>&lt;P&gt;Hi Shane,&lt;BR /&gt;
Thanks for the quick response. I am already doing xmlkv and extracting the XML values for me. &lt;/P&gt;

&lt;P&gt;Eg:&lt;/P&gt;

&lt;P&gt;body=Payment Overdue.Amount=176.Discount=16.Pay=160&lt;/P&gt;

&lt;P&gt;I can see rex command will be usefull. But i am looking for a generic rule which will extract every thing in "body" automatically.&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;kkn&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2013 05:33:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131908#M7776</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2013-11-07T05:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key value pair from xml</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131909#M7777</link>
      <description>&lt;P&gt;You can use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | extract pairdelim="." kvdelim="="
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2013 08:14:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131909#M7777</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2013-11-07T08:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key value pair from xml</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131910#M7778</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have tried that too..Didn't work. It may be because, the data source is xml. Just guessing...&lt;/P&gt;

&lt;P&gt;thx mate ..&lt;/P&gt;

&lt;P&gt;kkn&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2013 11:20:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131910#M7778</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2013-11-07T11:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract key value pair from xml</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131911#M7779</link>
      <description>&lt;P&gt;I don't know of anything to help you, other than what @gkanapathy suggested. You can always setup what he suggested in your props.conf and transforms.conf. This should automatically extract any values that are preceded by an "=" sign as a value of the field before the "=" sign for the sourcetype you specify.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2013 00:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-key-value-pair-from-xml/m-p/131911#M7779</guid>
      <dc:creator>ShaneNewman</dc:creator>
      <dc:date>2013-11-12T00:19:30Z</dc:date>
    </item>
  </channel>
</rss>

