<?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 How do I edit my search to filter XML content and only show failed status for a specific node? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213329#M62562</link>
    <description>&lt;P&gt;I have an XML results input that is indexed on per Test Suite.  Each Test Suite has many Test Cases, and each Test Case has many Test Steps.&lt;/P&gt;

&lt;P&gt;I am trying to create a report where we would like to find out which Test Suite, Case, and Steps failed and what was the error message.  However, my search is coming back with all the test case names, and all messages regardless of failure or success.  Is there a way to filter out just the failed status for a specific node?&lt;/P&gt;

&lt;P&gt;Current search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=test_suite_result_xml testRunnerResults.testCase.status=FAILED | stats values(testSuiteName) values(testRunnerResults.testCase.testCaseName) values(testRunnerResults.testCase.testStepResults.result.message) by testRunnerResults.testCase.testCaseName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample XML data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;testSuite&amp;gt;
    &amp;lt;startTime&amp;gt;15:33:18&amp;lt;/startTime&amp;gt;
    &amp;lt;status&amp;gt;FAILED&amp;lt;/status&amp;gt;
    &amp;lt;testSuiteName&amp;gt;UserLifecycleManager&amp;lt;/testSuiteName&amp;gt;
    &amp;lt;timeTaken&amp;gt;399799&amp;lt;/timeTaken&amp;gt;
    &amp;lt;testRunnerResults&amp;gt;
      &amp;lt;testCase&amp;gt;
        &amp;lt;reason&amp;gt;Failing due to failed test step&amp;lt;/reason&amp;gt;
        &amp;lt;startTime&amp;gt;15:33:18&amp;lt;/startTime&amp;gt;
        &amp;lt;status&amp;gt;FAILED&amp;lt;/status&amp;gt;
        &amp;lt;testCaseId&amp;gt;f1d9066c-6744-462e-bf76-6eed9b610a5a&amp;lt;/testCaseId&amp;gt;
        &amp;lt;testCaseName&amp;gt;CreateUser&amp;lt;/testCaseName&amp;gt;
        &amp;lt;timeTaken&amp;gt;1881&amp;lt;/timeTaken&amp;gt;
        &amp;lt;testStepResults&amp;gt;
          &amp;lt;result&amp;gt;
            &amp;lt;message&amp;gt;[GetApplicationAndBaseUrl] OK: took 279 ms&amp;lt;/message&amp;gt;
            &amp;lt;name&amp;gt;GetApplicationAndBaseUrl&amp;lt;/name&amp;gt;
            &amp;lt;order&amp;gt;2&amp;lt;/order&amp;gt;
            &amp;lt;started&amp;gt;15:33:18.431&amp;lt;/started&amp;gt;
            &amp;lt;status&amp;gt;OK&amp;lt;/status&amp;gt;
            &amp;lt;timeTaken&amp;gt;279&amp;lt;/timeTaken&amp;gt;
          &amp;lt;/result&amp;gt;
          &amp;lt;result&amp;gt;
            &amp;lt;message&amp;gt;[CreateNewUser] FAILED: took 281 ms
 -&amp;gt; [Valid HTTP Status Codes] Response status code:400 is not in acceptable list of status codes&amp;lt;/message&amp;gt;
            &amp;lt;name&amp;gt;CreateNewUser&amp;lt;/name&amp;gt;
            &amp;lt;order&amp;gt;9&amp;lt;/order&amp;gt;
            &amp;lt;started&amp;gt;15:33:20.622&amp;lt;/started&amp;gt;
            &amp;lt;status&amp;gt;FAILED&amp;lt;/status&amp;gt;
            &amp;lt;timeTaken&amp;gt;281&amp;lt;/timeTaken&amp;gt;
          &amp;lt;/result&amp;gt;
        &amp;lt;/testStepResults&amp;gt;
      &amp;lt;/testCase&amp;gt;
      &amp;lt;testCase&amp;gt;
        &amp;lt;reason&amp;gt;&amp;lt;/reason&amp;gt;
        &amp;lt;startTime&amp;gt;15:33:21&amp;lt;/startTime&amp;gt;
        &amp;lt;status&amp;gt;FINISHED&amp;lt;/status&amp;gt;
        &amp;lt;testCaseId&amp;gt;f72a96f9-64f5-4ce4-861a-151e3aadd41f&amp;lt;/testCaseId&amp;gt;
        &amp;lt;testCaseName&amp;gt;VerifyGroup&amp;lt;/testCaseName&amp;gt;
        &amp;lt;timeTaken&amp;gt;598&amp;lt;/timeTaken&amp;gt;
        &amp;lt;testStepResults&amp;gt;
          &amp;lt;result&amp;gt;
            &amp;lt;message&amp;gt;[GetApplicationAndBaseUrl] OK: took 256 ms&amp;lt;/message&amp;gt;
            &amp;lt;name&amp;gt;GetApplicationAndBaseUrl&amp;lt;/name&amp;gt;
            &amp;lt;order&amp;gt;2&amp;lt;/order&amp;gt;
            &amp;lt;started&amp;gt;15:33:21.568&amp;lt;/started&amp;gt;
            &amp;lt;status&amp;gt;OK&amp;lt;/status&amp;gt;
            &amp;lt;timeTaken&amp;gt;256&amp;lt;/timeTaken&amp;gt;
          &amp;lt;/result&amp;gt;
        &amp;lt;/testStepResults&amp;gt;
      &amp;lt;/testCase&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 04 Nov 2015 18:20:19 GMT</pubDate>
    <dc:creator>dablackgoku1234</dc:creator>
    <dc:date>2015-11-04T18:20:19Z</dc:date>
    <item>
      <title>How do I edit my search to filter XML content and only show failed status for a specific node?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213329#M62562</link>
      <description>&lt;P&gt;I have an XML results input that is indexed on per Test Suite.  Each Test Suite has many Test Cases, and each Test Case has many Test Steps.&lt;/P&gt;

&lt;P&gt;I am trying to create a report where we would like to find out which Test Suite, Case, and Steps failed and what was the error message.  However, my search is coming back with all the test case names, and all messages regardless of failure or success.  Is there a way to filter out just the failed status for a specific node?&lt;/P&gt;

&lt;P&gt;Current search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=test_suite_result_xml testRunnerResults.testCase.status=FAILED | stats values(testSuiteName) values(testRunnerResults.testCase.testCaseName) values(testRunnerResults.testCase.testStepResults.result.message) by testRunnerResults.testCase.testCaseName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample XML data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;testSuite&amp;gt;
    &amp;lt;startTime&amp;gt;15:33:18&amp;lt;/startTime&amp;gt;
    &amp;lt;status&amp;gt;FAILED&amp;lt;/status&amp;gt;
    &amp;lt;testSuiteName&amp;gt;UserLifecycleManager&amp;lt;/testSuiteName&amp;gt;
    &amp;lt;timeTaken&amp;gt;399799&amp;lt;/timeTaken&amp;gt;
    &amp;lt;testRunnerResults&amp;gt;
      &amp;lt;testCase&amp;gt;
        &amp;lt;reason&amp;gt;Failing due to failed test step&amp;lt;/reason&amp;gt;
        &amp;lt;startTime&amp;gt;15:33:18&amp;lt;/startTime&amp;gt;
        &amp;lt;status&amp;gt;FAILED&amp;lt;/status&amp;gt;
        &amp;lt;testCaseId&amp;gt;f1d9066c-6744-462e-bf76-6eed9b610a5a&amp;lt;/testCaseId&amp;gt;
        &amp;lt;testCaseName&amp;gt;CreateUser&amp;lt;/testCaseName&amp;gt;
        &amp;lt;timeTaken&amp;gt;1881&amp;lt;/timeTaken&amp;gt;
        &amp;lt;testStepResults&amp;gt;
          &amp;lt;result&amp;gt;
            &amp;lt;message&amp;gt;[GetApplicationAndBaseUrl] OK: took 279 ms&amp;lt;/message&amp;gt;
            &amp;lt;name&amp;gt;GetApplicationAndBaseUrl&amp;lt;/name&amp;gt;
            &amp;lt;order&amp;gt;2&amp;lt;/order&amp;gt;
            &amp;lt;started&amp;gt;15:33:18.431&amp;lt;/started&amp;gt;
            &amp;lt;status&amp;gt;OK&amp;lt;/status&amp;gt;
            &amp;lt;timeTaken&amp;gt;279&amp;lt;/timeTaken&amp;gt;
          &amp;lt;/result&amp;gt;
          &amp;lt;result&amp;gt;
            &amp;lt;message&amp;gt;[CreateNewUser] FAILED: took 281 ms
 -&amp;gt; [Valid HTTP Status Codes] Response status code:400 is not in acceptable list of status codes&amp;lt;/message&amp;gt;
            &amp;lt;name&amp;gt;CreateNewUser&amp;lt;/name&amp;gt;
            &amp;lt;order&amp;gt;9&amp;lt;/order&amp;gt;
            &amp;lt;started&amp;gt;15:33:20.622&amp;lt;/started&amp;gt;
            &amp;lt;status&amp;gt;FAILED&amp;lt;/status&amp;gt;
            &amp;lt;timeTaken&amp;gt;281&amp;lt;/timeTaken&amp;gt;
          &amp;lt;/result&amp;gt;
        &amp;lt;/testStepResults&amp;gt;
      &amp;lt;/testCase&amp;gt;
      &amp;lt;testCase&amp;gt;
        &amp;lt;reason&amp;gt;&amp;lt;/reason&amp;gt;
        &amp;lt;startTime&amp;gt;15:33:21&amp;lt;/startTime&amp;gt;
        &amp;lt;status&amp;gt;FINISHED&amp;lt;/status&amp;gt;
        &amp;lt;testCaseId&amp;gt;f72a96f9-64f5-4ce4-861a-151e3aadd41f&amp;lt;/testCaseId&amp;gt;
        &amp;lt;testCaseName&amp;gt;VerifyGroup&amp;lt;/testCaseName&amp;gt;
        &amp;lt;timeTaken&amp;gt;598&amp;lt;/timeTaken&amp;gt;
        &amp;lt;testStepResults&amp;gt;
          &amp;lt;result&amp;gt;
            &amp;lt;message&amp;gt;[GetApplicationAndBaseUrl] OK: took 256 ms&amp;lt;/message&amp;gt;
            &amp;lt;name&amp;gt;GetApplicationAndBaseUrl&amp;lt;/name&amp;gt;
            &amp;lt;order&amp;gt;2&amp;lt;/order&amp;gt;
            &amp;lt;started&amp;gt;15:33:21.568&amp;lt;/started&amp;gt;
            &amp;lt;status&amp;gt;OK&amp;lt;/status&amp;gt;
            &amp;lt;timeTaken&amp;gt;256&amp;lt;/timeTaken&amp;gt;
          &amp;lt;/result&amp;gt;
        &amp;lt;/testStepResults&amp;gt;
      &amp;lt;/testCase&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Nov 2015 18:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213329#M62562</guid>
      <dc:creator>dablackgoku1234</dc:creator>
      <dc:date>2015-11-04T18:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to filter XML content and only show failed status for a specific node?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213330#M62563</link>
      <description>&lt;P&gt;Have you setup your Search Head to accept the XML formatted data so that it extracts the fields directly? Add this to the props.conf on your Search Heads for the sourcetype set for this data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YOUR_SOURCETYPE]
KV_MODE = xml
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you should be able to code your searches to look for the failed tests:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SOURCETYPE="your_sourcetype" status="FAILED"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Nov 2015 18:55:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213330#M62563</guid>
      <dc:creator>curryRick</dc:creator>
      <dc:date>2015-11-04T18:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to filter XML content and only show failed status for a specific node?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213331#M62564</link>
      <description>&lt;P&gt;Yes, and I have the breaks on the testSuite tags&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test_suite_result_xml]
DATETIME_CONFIG = 
KV_MODE = xml
LINE_BREAKER = (&amp;lt;testSuite&amp;gt;)
MUST_BREAK_AFTER = \&amp;lt;/testSuite\&amp;gt;
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = true
TRUNCATE = 0
pulldown_type = true
BREAK_ONLY_BEFORE = (&amp;lt;testSuite&amp;gt;)
TIME_PREFIX = &amp;lt;startTime&amp;gt;
category = Custom
disabled = false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Nov 2015 21:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213331#M62564</guid>
      <dc:creator>dablackgoku1234</dc:creator>
      <dc:date>2015-11-04T21:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to filter XML content and only show failed status for a specific node?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213332#M62565</link>
      <description>&lt;P&gt;I'm getting a bit closer, however, still not the exact format I'l looking for...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="testSuiteResults.xml" sourcetype="test_suite_result_xml" testSuite.status="FAILED" | xpath outfield=message "//testSuite/testRunnerResults/testCase/testStepResults/result[status="FAILED"]/message" | xpath outfield=testSuiteName "//testSuite/testSuiteName" | xpath outfield=testCaseName "//testSuite/testRunnerResults/testCase[status="FAILED"]/testCaseName" | xpath outfield=name "//testSuite/testRunnerResults/testCase/testStepResults/result[status="FAILED"]/name" | table testSuiteName, testCaseName, name, message
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result I'm getting is each Test Suite is a row with all failed Test Cases and Messages. Is it possible for each Message to be a row with the corresponding Test Case name?&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/785iFCCEA1BF263DE491/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 19:23:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213332#M62565</guid>
      <dc:creator>dablackgoku1234</dc:creator>
      <dc:date>2015-11-06T19:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to filter XML content and only show failed status for a specific node?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213333#M62566</link>
      <description>&lt;P&gt;Have you tried the mvexpand command (&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/mvexpand"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/SearchReference/mvexpand&lt;/A&gt;). That may give you the results you are looking for. &lt;/P&gt;

&lt;P&gt;..| mvexpand message&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 20:52:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213333#M62566</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-06T20:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to filter XML content and only show failed status for a specific node?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213334#M62567</link>
      <description>&lt;P&gt;These are (mostly) index time settings. Are your Indexers and Search Heads separate servers (distributed architecture)? If so, the KV_MODE setting of props.conf needs to be on your Search Heads.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2015 18:14:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-filter-XML-content-and-only-show/m-p/213334#M62567</guid>
      <dc:creator>curryRick</dc:creator>
      <dc:date>2015-11-09T18:14:15Z</dc:date>
    </item>
  </channel>
</rss>

