<?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: spath vs xpath parse xml in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569480#M198489</link>
    <description>&lt;P&gt;What do you get without the last table line?&lt;/P&gt;</description>
    <pubDate>Sun, 03 Oct 2021 16:51:24 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-10-03T16:51:24Z</dc:date>
    <item>
      <title>spath vs xpath parse xml</title>
      <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569473#M198483</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;i have xml file like this, how can i table it with xpath or spath?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&amp;gt;&lt;BR /&gt;&amp;lt;info xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="noopener"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;error-codes&amp;gt;&lt;BR /&gt;&amp;lt;error-code code="000" message="Exceeded" severity="1" InfoCode="0000" action="" description=""/&amp;gt;&lt;BR /&gt;&amp;lt;error-code code="001" message="Not Found" severity="1" InfoCode="0000" action="" description=" nope"/&amp;gt;&lt;BR /&gt;&amp;lt;/error-codes&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/info&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;excpected output:&lt;/P&gt;&lt;P&gt;....&amp;nbsp; | table&amp;nbsp;code&amp;nbsp;message&amp;nbsp;severity&amp;nbsp;InfoCode&amp;nbsp;&amp;nbsp;action&amp;nbsp;description&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 10:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569473#M198483</guid>
      <dc:creator>indeed_2000</dc:creator>
      <dc:date>2021-10-03T10:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: spath vs xpath parse xml</title>
      <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569475#M198484</link>
      <description>&lt;P&gt;Firstly split error-codes into separate events, then extract all the field attributes, then create new fields based on the attribute name&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="&amp;lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?&amp;gt;
&amp;lt;info xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"&amp;gt;
&amp;lt;error-codes&amp;gt;
&amp;lt;error-code code=\"000\" message=\"Exceeded\" severity=\"1\" InfoCode=\"0000\" action=\"\" description=\"\"/&amp;gt;
&amp;lt;error-code code=\"001\" message=\"Not Found\" severity=\"1\" InfoCode=\"0000\" action=\"\" description=\" nope\"/&amp;gt;
&amp;lt;/error-codes&amp;gt;

&amp;lt;/info&amp;gt;"



| spath path="info.error-codes" output=errorcodes
| eval _raw=errorcodes
| multikv noheader=t
| table _raw
| spath
| foreach "error-code{@*}"
    [| eval _name="&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;"
    | eval {_name}='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;']
| rename error-code* as _error-code*
| table code message severity InfoCode  action description&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 03 Oct 2021 11:44:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569475#M198484</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-03T11:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: spath vs xpath parse xml</title>
      <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569477#M198486</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;Thank you for answer&lt;/P&gt;&lt;P&gt;i can see it successfuly extract fields from xml file, when i run this spl&amp;nbsp; ....| table _raw&lt;/P&gt;&lt;P&gt;but no result when I run this&amp;nbsp;&amp;nbsp; ....|&amp;nbsp; table code message severity InfoCode action description&lt;/P&gt;&lt;P&gt;here is the full spl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="my-index" source="/home/file.xml"
| spath path="info.error-codes" output=errorcodes
| eval _raw=errorcodes
| multikv noheader=t
| table _raw
| spath
| foreach "error-code{@*}"
    [| eval _name="&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;"
    | eval {_name}='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;']
| rename error-code* as _error-code*
| table code message severity InfoCode  action description&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="lia-panel lia-panel-standard MessageTagsTaplet Chrome lia-component-message-view-widget-tags"&gt;&lt;DIV class="lia-decoration-border"&gt;&lt;DIV class="lia-decoration-border-top"&gt;&lt;DIV&gt;any idea?&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 03 Oct 2021 15:28:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569477#M198486</guid>
      <dc:creator>indeed_2000</dc:creator>
      <dc:date>2021-10-03T15:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: spath vs xpath parse xml</title>
      <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569478#M198487</link>
      <description>&lt;P&gt;You haven't got a closing double quote around your index name?&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 14:55:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569478#M198487</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-03T14:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: spath vs xpath parse xml</title>
      <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569479#M198488</link>
      <description>&lt;P&gt;when i copy here accidentally removed, corect spl have double quotes.&lt;/P&gt;&lt;P&gt;I modify last reply.&lt;/P&gt;&lt;P&gt;any other idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 15:29:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569479#M198488</guid>
      <dc:creator>indeed_2000</dc:creator>
      <dc:date>2021-10-03T15:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: spath vs xpath parse xml</title>
      <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569480#M198489</link>
      <description>&lt;P&gt;What do you get without the last table line?&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 16:51:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569480#M198489</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-03T16:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: spath vs xpath parse xml</title>
      <link>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569487#M198491</link>
      <description>&lt;P&gt;after some workaround it work,I try to remove file and add with custom source type. finally table return result.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 20:50:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/spath-vs-xpath-parse-xml/m-p/569487#M198491</guid>
      <dc:creator>indeed_2000</dc:creator>
      <dc:date>2021-10-03T20:50:19Z</dc:date>
    </item>
  </channel>
</rss>

