<?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: xpath not giving result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362752#M107182</link>
    <description>&lt;P&gt;Following is the link to regex I have tested with the sample data provided on &lt;A href="https://regex101.com/r/lzp90v/1"&gt;regex101&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Like I have mentioned before, regular expressions are heavily based on pattern in the text data. You should at least check the raw sample event whether it matches the pattern of data you have or not.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Mar 2018 06:48:50 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-03-20T06:48:50Z</dc:date>
    <item>
      <title>xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362741#M107171</link>
      <description>&lt;P&gt;I want to extract NewValue when Network Settings is International Roaming Bar.&lt;/P&gt;

&lt;P&gt;Tried with | xpath outfield=NewValue "//SiebelMessage/ListOfVfNetworkSettings/VfNetworkSettings/[NetworkSetting=\"International Roaming Bar\"]/NewValue"&lt;/P&gt;

&lt;P&gt;But No results.&lt;/P&gt;

&lt;P&gt;UnbarredAdministration BarBarring123abcdNANHL|BarredStatusAUUnbarredIDD BarBarring123abcdNANHL|StatusAUUnbarredIncoming CallsBarring123abcdNANHL|StatusAUUnbarred*&lt;EM&gt;International Roaming Bar&lt;/EM&gt;&lt;EM&gt;Barring123abcdNANHL|&lt;/EM&gt;***StatusAUUnbarred&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:33:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362741#M107171</guid>
      <dc:creator>payal23</dc:creator>
      <dc:date>2020-09-29T18:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362742#M107172</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;&amp;lt;SiebelMessage TransactionName="A" IntObjectName="B" IntObjectFormat="C"&amp;gt;&amp;lt;ListOfVfNetworkSettings&amp;gt;&amp;lt;VfNetworkSettings&amp;gt;&amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;&amp;lt;NetworkSetting&amp;gt;Administration Bar&amp;lt;/NetworkSetting&amp;gt;&amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;&amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;&amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;&amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;&amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;&amp;lt;NewValue&amp;gt;Barred&amp;lt;/NewValue&amp;gt;&amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;&amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;&amp;lt;/VfNetworkSettings&amp;gt;&amp;lt;VfNetworkSettings&amp;gt;&amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;&amp;lt;NetworkSetting&amp;gt;IDD Bar&amp;lt;/NetworkSetting&amp;gt;&amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;&amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;&amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;&amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;&amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;&amp;lt;NewValue/&amp;gt;&amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;&amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;&amp;lt;/VfNetworkSettings&amp;gt;&amp;lt;VfNetworkSettings&amp;gt;&amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;&amp;lt;NetworkSetting&amp;gt;Incoming Calls&amp;lt;/NetworkSetting&amp;gt;&amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;&amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;&amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;&amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;&amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;&amp;lt;NewValue/&amp;gt;&amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;&amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;&amp;lt;/VfNetworkSettings&amp;gt;&amp;lt;VfNetworkSettings&amp;gt;&amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;&amp;lt;NetworkSetting&amp;gt;International Roaming Bar&amp;lt;/NetworkSetting&amp;gt;&amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;&amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;&amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;&amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;&amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;&amp;lt;NewValue/&amp;gt;&amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;&amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;&amp;lt;/VfNetworkSettings&amp;gt;&amp;lt;VfNetworkSettings&amp;gt;&amp;lt;CurrentValue&amp;gt;Unbarred
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Mar 2018 03:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362742#M107172</guid>
      <dc:creator>payal23</dc:creator>
      <dc:date>2018-03-18T03:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362743#M107173</link>
      <description>&lt;P&gt;@payal23 I think you would need to edit question and re-post the code and XML using &lt;CODE&gt;code button 101010&lt;/CODE&gt; provided on Splunk Answers so that special characters do not escape. Also if your indexed data is xml you can set &lt;CODE&gt;KV_MODE=xml&lt;/CODE&gt; in &lt;CODE&gt;props.conf&lt;/CODE&gt; to have xml nodes extracted automatically during search time.&lt;/P&gt;

&lt;P&gt;Other option would be to pipe &lt;CODE&gt;spath&lt;/CODE&gt; to your base search. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBaseSearch&amp;gt;
| spath
| table *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Mar 2018 04:40:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362743#M107173</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-18T04:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362744#M107174</link>
      <description>&lt;P&gt;&lt;STRONG&gt;[Updated Answer]&lt;/STRONG&gt; Query for correlating &lt;CODE&gt;NewValue&lt;/CODE&gt; with &lt;CODE&gt;NetworkSetting&lt;/CODE&gt;&lt;BR /&gt;
Following query will find &lt;CODE&gt;Barred&lt;/CODE&gt; NewValue for &lt;CODE&gt;International Roaming Bar&lt;/CODE&gt; NetworkSetting&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="&amp;lt;SiebelMessage TransactionName=\"A\" IntObjectName=\"B\" IntObjectFormat=\"C\"&amp;gt;
    &amp;lt;ListOfVfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;Administration Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue&amp;gt;Barred&amp;lt;/NewValue&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;IDD Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;Incoming Calls&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;International Roaming Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
    &amp;lt;/ListOfVfNetworkSettings&amp;gt;
&amp;lt;/SiebelMessage&amp;gt;"
| eval _raw=replace(_raw,"\&amp;lt;NewValue\/\&amp;gt;","&amp;lt;NewValue&amp;gt;null&amp;lt;/NewValue&amp;gt;")
| spath
| rename SiebelMessage.ListOfVfNetworkSettings.VfNetworkSettings.NewValue as NewValue SiebelMessage.ListOfVfNetworkSettings.VfNetworkSettings.NetworkSetting as NetworkSetting
| stats count by NewValue NetworkSetting
| search NewValue="Barred" AND NetworkSetting="International Roaming Bar"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: First two pipes &lt;CODE&gt;makeresult&lt;/CODE&gt; and &lt;CODE&gt;eval _raw&lt;/CODE&gt; is to mock data. You can use your base search instead.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;@Payal23, Following is one of the options with &lt;CODE&gt;spath&lt;/CODE&gt; (run anywhere search added based on sample data). I have replaced empty &lt;CODE&gt;&amp;lt;NewValue/&amp;gt;&lt;/CODE&gt; with some default value for 1:1 mapping of &lt;CODE&gt;CurrentValue&lt;/CODE&gt; and &lt;CODE&gt;NewValue&lt;/CODE&gt; multi-value fields.&lt;BR /&gt;
PS: As stated earlier if the event being indexed to Splunk is XML you can turn on &lt;CODE&gt;KV_MODE=xml&lt;/CODE&gt; in &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;props.conf&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="&amp;lt;SiebelMessage TransactionName=\"A\" IntObjectName=\"B\" IntObjectFormat=\"C\"&amp;gt;
    &amp;lt;ListOfVfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;Administration Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue&amp;gt;Barred&amp;lt;/NewValue&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;IDD Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;Incoming Calls&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;International Roaming Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
    &amp;lt;/ListOfVfNetworkSettings&amp;gt;
&amp;lt;/SiebelMessage&amp;gt;"
| eval _raw=replace(_raw,"\&amp;lt;NewValue\/\&amp;gt;","&amp;lt;NewValue&amp;gt;null&amp;lt;/NewValue&amp;gt;")
| spath
| table *CurrentValue *NewValue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: If you take out the final &lt;CODE&gt;table&lt;/CODE&gt; command you will see all the fields. If you do not want spath to extract all the fields similar to xpath, you can provide path for field extraction and output field name. Refer to &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath"&gt;spath&lt;/A&gt; command.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Mar 2018 05:35:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362744#M107174</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-18T05:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362745#M107175</link>
      <description>&lt;P&gt;@niketnilay Actually my requirement is to calculate the count of the events when NewValue is Barred for International Roaming Bar.&lt;/P&gt;

&lt;P&gt;And the xml pattern is like &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;International Roaming Bar can be in
any VfNetworkSettings tag. &lt;/LI&gt;
&lt;LI&gt;Tags
present in between VfNetworkSettings
tag can be in any sequence.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;So, based on this condition can you help me in understanding how KV_MODE=xml or spath will help?&lt;/P&gt;

&lt;P&gt;And if i ignore the 2nd point and just try to get the NewValue from the sample attached with the help of xpath, am not getting results.&lt;/P&gt;

&lt;P&gt;|xpath outfield=NewValue "//SiebelMessage/ListOfVfNetworkSettings/VfNetworkSettings/[NetworkSetting=\"International Roaming Bar\"]/NewValue"|table NewValue&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;SiebelMessage TransactionName="VF Update Network Settings" IntObjectName="VF Network Settings Update Request" IntObjectFormat="Siebel Hierarchical"&amp;gt;&amp;lt;ListOfVfNetworkSettings&amp;gt;&amp;lt;VfNetworkSettings&amp;gt;&amp;lt;ARII&amp;gt;AU&amp;lt;/ARII&amp;gt;&amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;&amp;lt;NetworkSetting&amp;gt;International Roaming Bar&amp;lt;/NetworkSetting&amp;gt;&amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;&amp;lt;IMSI&amp;gt;234&amp;lt;/IMSI&amp;gt;&amp;lt;MSISDN&amp;gt;123&amp;lt;/MSISDN&amp;gt;&amp;lt;NeServiceName/&amp;gt;&amp;lt;NewValue&amp;gt;Barred&amp;lt;/NewValue&amp;gt;&amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;&amp;lt;/VfNetworkSettings&amp;gt;&amp;lt;VfNetworkSettings&amp;gt;&amp;lt;ARII&amp;gt;AU&amp;lt;/ARII&amp;gt;&amp;lt;CurrentValue&amp;gt;Barred&amp;lt;/CurrentValue&amp;gt;&amp;lt;NetworkSetting&amp;gt;IDD Bar&amp;lt;/NetworkSetting&amp;gt;&amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;&amp;lt;IMSI&amp;gt;456&amp;lt;/IMSI&amp;gt;&amp;lt;MSISDN&amp;gt;123&amp;lt;/MSISDN&amp;gt;&amp;lt;NeServiceName/&amp;gt;&amp;lt;NewValue&amp;gt;Unbarred&amp;lt;/NewValue&amp;gt;&amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;&amp;lt;/VfNetworkSettings&amp;gt;&amp;lt;/ListOfVfNetworkSettings&amp;gt;&amp;lt;/SiebelMessage&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Mar 2018 15:02:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362745#M107175</guid>
      <dc:creator>payal23</dc:creator>
      <dc:date>2018-03-18T15:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362746#M107176</link>
      <description>&lt;P&gt;@payal23, &lt;CODE&gt;KV_MODE=xml&lt;/CODE&gt; extracts all the field from XML data during search so that you do not have to go after all the field extractions. Similarly with spath command on _raw all xml nodes will be extracted automatically. You can choose the fields you are interested in.&lt;/P&gt;

&lt;P&gt;Since your single xml has multiple &lt;CODE&gt;&amp;lt;VfNetworkSettings&amp;gt;&lt;/CODE&gt; you would be working with multiple-values. Also some of the &lt;CODE&gt;&amp;lt;NewValue&amp;gt;&lt;/CODE&gt; nodes in &lt;CODE&gt;&amp;lt;VfNetworkSettings&amp;gt;&lt;/CODE&gt; are null. Which means multiple values might not get mapped one to one. For which I have populated null values in the raw event.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _raw=replace(_raw,"\&amp;lt;NewValue\/\&amp;gt;","&amp;lt;NewValue&amp;gt;null&amp;lt;/NewValue&amp;gt;")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As far as &lt;CODE&gt;xpath&lt;/CODE&gt; is concerned I notice that the documented feature of the command does not seem to be working as expected. The following works &lt;CODE&gt;| xpath outfield=NewValue "//SiebelMessage/ListOfVfNetworkSettings/VfNetworkSettings/NewValue"&lt;/CODE&gt; but this one does not &lt;CODE&gt;| xpath outfield=NewValue "//SiebelMessage/ListOfVfNetworkSettings/VfNetworkSettings[NetworkSetting=\"Barred\"]/NewValue"&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="&amp;lt;SiebelMessage TransactionName=\"A\" IntObjectName=\"B\" IntObjectFormat=\"C\"&amp;gt;
    &amp;lt;ListOfVfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;Administration Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue&amp;gt;Barred&amp;lt;/NewValue&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;IDD Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;Incoming Calls&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
        &amp;lt;VfNetworkSettings&amp;gt;
            &amp;lt;CurrentValue&amp;gt;Unbarred&amp;lt;/CurrentValue&amp;gt;
            &amp;lt;NetworkSetting&amp;gt;International Roaming Bar&amp;lt;/NetworkSetting&amp;gt;
            &amp;lt;Type&amp;gt;Barring&amp;lt;/Type&amp;gt;
            &amp;lt;IMSI&amp;gt;123&amp;lt;/IMSI&amp;gt;
            &amp;lt;MSISDN&amp;gt;abcd&amp;lt;/MSISDN&amp;gt;
            &amp;lt;SecondarySubs&amp;gt;N&amp;lt;/SecondarySubs&amp;gt;
            &amp;lt;NeServiceName&amp;gt;ANHL|&amp;lt;/NeServiceName&amp;gt;
            &amp;lt;NewValue/&amp;gt;
            &amp;lt;Attribute&amp;gt;Status&amp;lt;/Attribute&amp;gt;
            &amp;lt;ServiceProvider&amp;gt;AU&amp;lt;/ServiceProvider&amp;gt;
        &amp;lt;/VfNetworkSettings&amp;gt;
    &amp;lt;/ListOfVfNetworkSettings&amp;gt;
&amp;lt;/SiebelMessage&amp;gt;" 
| eval _raw=replace(_raw,"\&amp;lt;NewValue\/\&amp;gt;","&amp;lt;NewValue&amp;gt;null&amp;lt;/NewValue&amp;gt;") 
| xpath outfield=NewValue "//SiebelMessage/ListOfVfNetworkSettings/VfNetworkSettings[NetworkSetting=\"Barred\"]/NewValue" field=_raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: Also noticed another issue with &lt;CODE&gt;xpath&lt;/CODE&gt; command where extracting two fields in the same search where both fields are multi-valued then first field becomes single value instead of multi-values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xpath outfield=NewValue "//SiebelMessage/ListOfVfNetworkSettings/VfNetworkSettings/NewValue" 
| xpath outfield=NetworkSetting "//SiebelMessage/ListOfVfNetworkSettings/VfNetworkSettings/NetworkSetting" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;OL&gt;
&lt;LI&gt;Try my solution with &lt;CODE&gt;spath&lt;/CODE&gt; from my previous answer and confirm.&lt;/LI&gt;
&lt;LI&gt;Add BUG tag to your question.&lt;/LI&gt;
&lt;LI&gt;If you have valid Splunk Entitlement please reach out to Splunk Support with the issue.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;PS: On a different note, please add comment to specific thread rather than posting a new Answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Mar 2018 16:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362746#M107176</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-18T16:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362747#M107177</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;
@niketnilay&lt;BR /&gt;
I tried with spath.. but I am not sure why it is not retrieving any results. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;|spath output=NewValue path=SiebelMessage.ListOfVfNetworkSettings.VfNetworkSettings.NewValue|table NewValue&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 01:39:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362747#M107177</guid>
      <dc:creator>payal23</dc:creator>
      <dc:date>2018-03-19T01:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362748#M107178</link>
      <description>&lt;P&gt;@payal23, if my run anywhere example with &lt;CODE&gt;makeresults&lt;/CODE&gt; is working then just adding &lt;CODE&gt;| spath&lt;/CODE&gt; should extract all the fields. If it is not doing so you will need to confirm whether your individual event logged in Splunk is xml or does it have any text prefixed/suffixed to it? First you would need to strip out any content apart from xml from the raw data for spath to work. Please check data and event.&lt;/P&gt;

&lt;P&gt;PS: following worked for me with &lt;CODE&gt;makeresults&lt;/CODE&gt; and &lt;CODE&gt;eval&lt;/CODE&gt; instead of &lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| eval _raw=replace(_raw,"\&amp;lt;NewValue\/\&amp;gt;","&amp;lt;NewValue&amp;gt;null&amp;lt;/NewValue&amp;gt;")
| spath output=NewValue path=SiebelMessage.ListOfVfNetworkSettings.VfNetworkSettings.NewValue
| spath output=NetworkSetting path=SiebelMessage.ListOfVfNetworkSettings.VfNetworkSettings.NetworkSetting
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 01:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362748#M107178</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-19T01:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362749#M107179</link>
      <description>&lt;P&gt;@niketnilay Yes.. makeresults query is working fine.&lt;/P&gt;

&lt;P&gt;And also the event is not purely XML.. it has few lines before XML. If i want to strip out the data have to create a new sourcetype and filter the events to get XML&lt;/P&gt;

&lt;P&gt;.&lt;CODE&gt;## 18 Mar 2018 11:10:07 [INFO] BusinessIdentifier : 123  **** MessageIdentifier : bc2  **** InterfaceName : UpdateNetworkSettings  **** ServiceLayerName : CRMServiceMgmtCVS  **** ServiceLayerOperation : VF Update Network Settings  **** ServiceLayerPipeline : requestPipeline ErrorCode :   **** ConsumerErrorMessage :   **** FusionErrorCode :   **** FusionErrorMessage :   **** FaultingServiceErrorCode :   **** FaultingServiceErrorMessage : &lt;BR /&gt;
     &amp;lt;ListOfVfNetworkSettings&amp;gt;.. rest xml&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;With the help of regex or anything else can we extract the same? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 02:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362749#M107179</guid>
      <dc:creator>payal23</dc:creator>
      <dc:date>2018-03-19T02:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362750#M107180</link>
      <description>&lt;P&gt;@payal23 try the following &lt;CODE&gt;rex&lt;/CODE&gt; to extract xml data from your raw events as first step.&lt;/P&gt;

&lt;P&gt;PS: As per the xml sample data shared initially the root node should be &lt;CODE&gt;&amp;lt;SiebelMessage&lt;/CODE&gt; not &lt;CODE&gt;&amp;lt;ListOfVfNetworkSettings&lt;/CODE&gt;. Since Regular Expression is based on pattern match, the rex command will work only with correct pattern based on your actual event. I have created Regular Expression based on the following to be the pattern: &lt;CODE&gt;FaultingServiceErrorMessage : &amp;lt;SiebelMessage&lt;/CODE&gt;. Please correct if the pattern is different. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?&amp;lt;ms&amp;gt;)&lt;/CODE&gt; has been added to rex command to make dot (&lt;CODE&gt;.&lt;/CODE&gt;) to match new line character as well in case xml has new line characters. Other option would be to remove new line character &lt;CODE&gt;\n\r&lt;/CODE&gt; from _raw data before applying &lt;CODE&gt;rex&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;The rex pattern ends at &lt;CODE&gt;&amp;lt;\/SiebelMessage&amp;gt;&lt;/CODE&gt; to get xml data as &lt;CODE&gt;_raw&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
| rex "(?ms)FaultingServiceErrorMessage : (?&amp;lt;_raw&amp;gt;\&amp;lt;SiebelMessage.*\&amp;lt;\/SiebelMessage\&amp;gt;)"
| eval _raw=replace(_raw,"\&amp;lt;NewValue\/\&amp;gt;","&amp;lt;NewValue&amp;gt;null&amp;lt;/NewValue&amp;gt;")
| spath
| rename SiebelMessage.ListOfVfNetworkSettings.VfNetworkSettings.NewValue as NewValue SiebelMessage.ListOfVfNetworkSettings.VfNetworkSettings.NetworkSetting as NetworkSetting
| stats count by NewValue NetworkSetting
| search NewValue="Barred" AND NetworkSetting="International Roaming Bar"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 03:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362750#M107180</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-19T03:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362751#M107181</link>
      <description>&lt;P&gt;@niketnilay Regex is not working.&lt;/P&gt;

&lt;P&gt;Is this regex working on _raw events.. I am not that good in regex.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
 | rex "(?ms)FaultingServiceErrorMessage : (?&amp;lt;_raw&amp;gt;\)"&lt;/CODE&gt;|table _raw&lt;/P&gt;

&lt;P&gt;When I do this it is not filtering _raw logs.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 06:14:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362751#M107181</guid>
      <dc:creator>payal23</dc:creator>
      <dc:date>2018-03-20T06:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362752#M107182</link>
      <description>&lt;P&gt;Following is the link to regex I have tested with the sample data provided on &lt;A href="https://regex101.com/r/lzp90v/1"&gt;regex101&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Like I have mentioned before, regular expressions are heavily based on pattern in the text data. You should at least check the raw sample event whether it matches the pattern of data you have or not.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 06:48:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362752#M107182</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-20T06:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362753#M107183</link>
      <description>&lt;P&gt;@niketnilay yayyyyy...its working finally!!!&lt;/P&gt;

&lt;P&gt;Thankyou so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex "FaultingServiceErrorMessage : [\n]+(?&amp;lt;_raw&amp;gt;\&amp;lt;SiebelMessage.*\&amp;lt;\/SiebelMessage\&amp;gt;)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Mar 2018 14:01:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362753#M107183</guid>
      <dc:creator>payal23</dc:creator>
      <dc:date>2018-03-20T14:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362754#M107184</link>
      <description>&lt;P&gt;Hi Payal..&lt;/P&gt;

&lt;P&gt;You can use the below regex for extracting the New value tag for International Roaming call...&lt;/P&gt;

&lt;P&gt;(?&amp;lt;=VfNetworkSettings).&lt;EM&gt;International\sRoaming\sBar.&lt;/EM&gt;?NewValue&amp;gt;(?[^&amp;lt;]+)&amp;lt;&lt;/P&gt;

&lt;P&gt;In Case of this field is null , you may need to check the isnull function of splunk to create a appropriate field.&lt;/P&gt;

&lt;P&gt;i.e like below&lt;/P&gt;

&lt;P&gt;&amp;lt;&amp;lt; Your base query " | rex "(?&amp;lt;=VfNetworkSettings).&lt;EM&gt;International\sRoaming\sBar.&lt;/EM&gt;?NewValue&amp;gt;(?[^&amp;lt;]+)&amp;lt;"| eval ActualField = if(isnull(MyField),"NA",MyField) | stats count by ActualField&lt;/P&gt;

&lt;P&gt;This will give u the count based on NewValue msg types,if its null we are creating "NA" msg. &lt;/P&gt;

&lt;P&gt;Hope this helps !!&lt;/P&gt;

&lt;P&gt;Happy Splunking &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 02:35:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362754#M107184</guid>
      <dc:creator>rakesh_498115</dc:creator>
      <dc:date>2018-03-22T02:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: xpath not giving result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362755#M107185</link>
      <description>&lt;P&gt;@payal23 glad you found a solution working for you.&lt;/P&gt;

&lt;P&gt;Seems like you accepted your own answer instead of mine. You can either accept my answer or up vote the comments that helped &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 05:26:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/xpath-not-giving-result/m-p/362755#M107185</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-22T05:26:15Z</dc:date>
    </item>
  </channel>
</rss>

