<?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: XML field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572244#M199442</link>
    <description>&lt;P&gt;Hi sir,&lt;/P&gt;&lt;P&gt;Thank you so much for the reply.. It works great..&lt;/P&gt;&lt;P&gt;Is there any way that i can merge error and failed into a single column called status? So that i can represent status in a single column?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Oct 2021 11:24:33 GMT</pubDate>
    <dc:creator>anooshac</dc:creator>
    <dc:date>2021-10-25T11:24:33Z</dc:date>
    <item>
      <title>XML field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572188#M199423</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Hi all, I have a xml file as below.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;suite name="abc" timestamp="20.08.2021 15:47:20" hostname="kkt2si" tests="5" failures="1" errors="1" time="0"&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;case name="a" time="626" classname="x"&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;failure message="failed" /&amp;gt; &amp;lt;/case&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;case name="b" time="427" classname="x" /&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;case name="C" time="616" classname="y" /&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;case name="d" time="626" classname="y"&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;error message="error" /&amp;gt; &amp;lt;/case&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;case name="e" time="621" classname="x" /&amp;gt; &amp;lt;/suite&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The cases which doesnt have failure or errors are the ones which are passed. I am able to make a list of cases but i am confused how to add a column of the status. Anyone know the solution for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|spath output=cases path=suite.case{@name}| table cases&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is how i extracted the cases. I want to add a column which shows the status. Please suggest some answers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Oct 2021 05:32:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572188#M199423</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2021-10-25T05:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: XML field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572230#M199436</link>
      <description>&lt;P&gt;You could try something like this - expand the empty cases to the full XML syntax, then extract the cases into separate events, then extract the attributes from each event&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="&amp;lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&amp;gt;
&amp;lt;suite name=\"abc\" timestamp=\"20.08.2021 15:47:20\" hostname=\"kkt2si\" tests=\"5\" failures=\"1\" errors=\"1\" time=\"0\"&amp;gt;
&amp;lt;case name=\"a\" time=\"626\" classname=\"x\"&amp;gt;
&amp;lt;failure message=\"failed\" /&amp;gt; &amp;lt;/case&amp;gt;
&amp;lt;case name=\"b\" time=\"427\" classname=\"x\" /&amp;gt;
&amp;lt;case name=\"C\" time=\"616\" classname=\"y\" /&amp;gt;
&amp;lt;case name=\"d\" time=\"626\" classname=\"y\"&amp;gt;
&amp;lt;error message=\"error\" /&amp;gt; &amp;lt;/case&amp;gt;
&amp;lt;case name=\"e\" time=\"621\" classname=\"x\" /&amp;gt; &amp;lt;/suite&amp;gt;"



| rex mode=sed max_match=0 "s/(?P&amp;lt;case&amp;gt;\&amp;lt;case )(?P&amp;lt;attr&amp;gt;[^\/\&amp;gt;]+)\/\&amp;gt;/\1\2&amp;gt;&amp;lt;\/case&amp;gt;/g"
| rex max_match=0 "(?ms)(?&amp;lt;case&amp;gt;\&amp;lt;case .+?\&amp;lt;\/case\&amp;gt;)"
| mvexpand case
| spath input=case output=name path=case{@name}
| spath input=case output=failed path=case.failure{@message}
| spath input=case output=error path=case.error{@message}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Oct 2021 10:25:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572230#M199436</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-25T10:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: XML field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572244#M199442</link>
      <description>&lt;P&gt;Hi sir,&lt;/P&gt;&lt;P&gt;Thank you so much for the reply.. It works great..&lt;/P&gt;&lt;P&gt;Is there any way that i can merge error and failed into a single column called status? So that i can represent status in a single column?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 11:24:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572244#M199442</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2021-10-25T11:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: XML field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572245#M199443</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval status=coalesce(failed, error)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Oct 2021 11:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572245#M199443</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-25T11:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: XML field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572254#M199447</link>
      <description>&lt;P&gt;yes.. Got it..&amp;nbsp; Thank you so much..&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 12:05:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/XML-field-extraction/m-p/572254#M199447</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2021-10-25T12:05:51Z</dc:date>
    </item>
  </channel>
</rss>

