<?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 split multilevel XML to extract fields and values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124031#M33497</link>
    <description>&lt;P&gt;Hai Badri Srinivas,&lt;/P&gt;

&lt;P&gt;Thanks for your answer and sorry for my late response. &lt;BR /&gt;
As you mentioned i have been added required details in  props.conf and transforms.conf.&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;P&gt;[xml_login_fields]&lt;BR /&gt;
 REGEX=([^&amp;lt;]+)&amp;gt;([^&amp;lt;]+)&amp;lt;&lt;BR /&gt;
 FORMAT = $1::$2 &lt;BR /&gt;
 MV_ADD = True&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;P&gt;[Gate]&lt;BR /&gt;
 KV_MODE = xml&lt;BR /&gt;
 REPORT-getting_logins_fields = xml_login_fields&lt;/P&gt;

&lt;P&gt;Still I'm not getting that XMl split-ted values.&lt;BR /&gt;
Might be i'm doing something wrong in search query.&lt;/P&gt;

&lt;P&gt;below mentioned is the search query i'm using.&lt;/P&gt;

&lt;P&gt;sourcetype="Gate_View" &lt;BR /&gt;
  | rename Masking_View.View_Info.stor_grpname as sg_name&lt;BR /&gt;
  | rename Masking_View.View_Info.Device.dev_name as dev_name&lt;BR /&gt;
  | rename Masking_View.View_Info.Totals.total_dev_cap_mb as total_dev_cap_mb &lt;BR /&gt;
  | fields sg_name, dev_name, total_dev_cap_mb &lt;/P&gt;

&lt;P&gt;If i'm wrong kindly correct me .&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 06:46:48 GMT</pubDate>
    <dc:creator>Shan</dc:creator>
    <dc:date>2020-09-29T06:46:48Z</dc:date>
    <item>
      <title>How to split multilevel XML to extract fields and values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124028#M33494</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;&amp;lt;messaging&amp;gt;&amp;lt;messaging_id&amp;gt;data_range&amp;lt;/messaging_id&amp;gt;&amp;lt;currentTimeStamp&amp;gt;2015-06-11-090445569807&amp;lt;/currentTimeStamp&amp;gt;
&amp;lt;TransStatus&amp;gt;Fee Query&amp;lt;/TransStatus&amp;gt;&amp;lt;IpAddress&amp;gt;180.31.2.21&amp;lt;/IpAddress&amp;gt;&amp;lt;Port&amp;gt;1342&amp;lt;/Port&amp;gt;&amp;lt;Header&amp;gt;&amp;lt;termID&amp;gt;GET&amp;lt;/termID&amp;gt;
&amp;lt;/Header&amp;gt;&amp;lt;partner&amp;gt;&amp;lt;id&amp;gt;&amp;lt;range&amp;gt;GTEST&amp;lt;/range&amp;gt;&amp;lt;/id&amp;gt;&amp;lt;/partner&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From the above mentioned result.&lt;BR /&gt;
I need to get the values as mentioned below using the rex command. Is it possible?&lt;BR /&gt;
All the above mentioned values are available in single field _raw.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;messaging_id   |    currentTimeStamp     |      range  
data_range     | 2015-06-11-090445569807 |      GTEST
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In some posts I saw show we can separate it using spath. &lt;BR /&gt;
I tried the same, but it's not working.&lt;BR /&gt;
I want to split it like below.&lt;BR /&gt;
If any other solution is out there, let me know that too. &lt;/P&gt;

&lt;P&gt;Sample Code &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;vendorProductSet vendorID="2"&amp;gt;
            &amp;lt;product productID="17" units="mm" &amp;gt;
                &amp;lt;prodName nameGroup="custom"&amp;gt;
                    &amp;lt;locName locale="all"&amp;gt;APLI 01209&amp;lt;/locName&amp;gt;
                &amp;lt;/prodName&amp;gt;
                &amp;lt;desc descGroup="custom"&amp;gt;
                    &amp;lt;locDesc locale="es"&amp;gt;Precios&amp;lt;/locDesc&amp;gt;
                    &amp;lt;locDesc locale="fr"&amp;gt;Prix&amp;lt;/locDesc&amp;gt;
                    &amp;lt;locDesc locale="de"&amp;gt;Preise&amp;lt;/locDesc&amp;gt;
                    &amp;lt;locDesc locale="ca"&amp;gt;Preus&amp;lt;/locDesc&amp;gt;
                    &amp;lt;locDesc locale="pt"&amp;gt;Preços&amp;lt;/locDesc&amp;gt; 
                &amp;lt;/desc&amp;gt;
           &amp;lt;/product&amp;gt;

       | spath output=locDesc path=vendorProductSet.product.desc.locDesc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result should be :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Precios Prix Preise
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried with below examples, but it's not working. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Masking_View.log" host="RAKESH-KR" sourcetype="Masking_View"
 | spath Masking_View.View_Info.stor_grpname 
 | spath Masking_View.View_Info.Device.dev_name  
 | spath Masking_View.View_Info.Totals.total_dev_cap_mb  
 | table  Masking_View.View_Info.stor_grpname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;C:\Program Files\Splunk\etc\system\local&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Masking_View.log" host="RAKESH-KR" sourcetype="Masking_View" 
 | rename Masking_View.View_Info.stor_grpname as sg_name
 | rename Masking_View.View_Info.Device.dev_name as dev_name
 | rename Masking_View.View_Info.Totals.total_dev_cap_mb as total_dev_cap_mb 
 | fields sg_name, dev_name, total_dev_cap_mb | eval f=substr(dev_name,1,2)  | table f 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="D:\\Masking_View.log" host="RAKESH-KR" sourcetype="Masking_View"  | rex field=_raw  "^(?:[^ \n]* ){7}(?P&amp;lt;xml&amp;gt;.+)"  | spath xml
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jul 2015 12:45:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124028#M33494</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2015-07-15T12:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to split multilevel XML to extract fields and values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124029#M33495</link>
      <description>&lt;P&gt;Hi Shankarananth,&lt;/P&gt;

&lt;P&gt;you can try to extract the field by using props.conf and transforms.conf instead of spath.&lt;/P&gt;

&lt;P&gt;Below is example&lt;/P&gt;

&lt;P&gt;$SPLUNK_HOME/etc/app/your_app/local/props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
KV_MODE = xml
REPORT-getting_logins_fields = xml_login_fields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;$SPLUNK_HOME/etc/app/your_app/local/transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[xml_login_fields]
REGEX=([^&amp;lt;]+)&amp;gt;([^&amp;lt;]+)&amp;lt;
FORMAT = $1::$2 
MV_ADD = True
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this will help you.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Badri Srinivas B&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:42:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124029#M33495</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T06:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to split multilevel XML to extract fields and values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124030#M33496</link>
      <description>&lt;P&gt;Hi Badri Srinivas,&lt;/P&gt;

&lt;P&gt;Thanks for your reply and sorry for late reply.&lt;BR /&gt;
I added details as u mentioned in props.conf and  transforms.conf . But still it's not working for me . &lt;BR /&gt;
I think i am doing some wrong approach in search query.&lt;BR /&gt;
Below mentioned is the search query i'm using to fetch that xml data filed.&lt;/P&gt;

&lt;P&gt;sourcetype="Masking_View" &lt;BR /&gt;
  | rename Masking_View.View_Info.stor_grpname as sg_name&lt;BR /&gt;
  | rename Masking_View.View_Info.Device.dev_name as dev_name&lt;BR /&gt;
  | rename Masking_View.View_Info.Totals.total_dev_cap_mb as total_dev_cap_mb &lt;BR /&gt;
  | fields sg_name, dev_name, total_dev_cap_mb | eval f=substr(dev_name,1,2)  | table f &lt;/P&gt;

&lt;P&gt;If i'm wrong correct me.&lt;BR /&gt;
Thanks in advance .&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124030#M33496</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2020-09-29T06:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to split multilevel XML to extract fields and values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124031#M33497</link>
      <description>&lt;P&gt;Hai Badri Srinivas,&lt;/P&gt;

&lt;P&gt;Thanks for your answer and sorry for my late response. &lt;BR /&gt;
As you mentioned i have been added required details in  props.conf and transforms.conf.&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;P&gt;[xml_login_fields]&lt;BR /&gt;
 REGEX=([^&amp;lt;]+)&amp;gt;([^&amp;lt;]+)&amp;lt;&lt;BR /&gt;
 FORMAT = $1::$2 &lt;BR /&gt;
 MV_ADD = True&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;P&gt;[Gate]&lt;BR /&gt;
 KV_MODE = xml&lt;BR /&gt;
 REPORT-getting_logins_fields = xml_login_fields&lt;/P&gt;

&lt;P&gt;Still I'm not getting that XMl split-ted values.&lt;BR /&gt;
Might be i'm doing something wrong in search query.&lt;/P&gt;

&lt;P&gt;below mentioned is the search query i'm using.&lt;/P&gt;

&lt;P&gt;sourcetype="Gate_View" &lt;BR /&gt;
  | rename Masking_View.View_Info.stor_grpname as sg_name&lt;BR /&gt;
  | rename Masking_View.View_Info.Device.dev_name as dev_name&lt;BR /&gt;
  | rename Masking_View.View_Info.Totals.total_dev_cap_mb as total_dev_cap_mb &lt;BR /&gt;
  | fields sg_name, dev_name, total_dev_cap_mb &lt;/P&gt;

&lt;P&gt;If i'm wrong kindly correct me .&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:46:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124031#M33497</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2020-09-29T06:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to split multilevel XML to extract fields and values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124032#M33498</link>
      <description>&lt;P&gt;Hi Shankarananth,&lt;/P&gt;

&lt;P&gt;You need to change the regex expression according to you xml source.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Badri Srinivas B&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 15:19:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-multilevel-XML-to-extract-fields-and-values/m-p/124032#M33498</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2015-07-27T15:19:29Z</dc:date>
    </item>
  </channel>
</rss>

