<?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 Help with Search in XML file-Multiple lines data for validation of HTTP response content validation for API calls in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612669#M213013</link>
    <description>&lt;P&gt;I am new to Splunk query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to capture the&amp;nbsp; filed value of &lt;STRONG&gt;tn&lt;/STRONG&gt; "&lt;STRONG&gt;Subscription_S04_LookupInvoiceStatus" &lt;/STRONG&gt;and&lt;STRONG&gt; Response data(Highlighted bold in the below XML file)&lt;/STRONG&gt;&amp;nbsp;for the corresponding "&lt;STRONG&gt;tn&lt;/STRONG&gt;" filed value and display under statistics.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;"Subscription_S04_LookupInvoiceStatus" &lt;/STRONG&gt;value present multiple times in the XML file&amp;nbsp; &amp;nbsp;and &lt;STRONG&gt;Response data&lt;/STRONG&gt; for the corresponding "&lt;STRONG&gt;tn&lt;/STRONG&gt;" filed value, I want to query for unique one(Remove duplicates)&lt;/P&gt;
&lt;P&gt;I tried the below query, but its not pulling the response Data.&lt;/P&gt;
&lt;P&gt;Kindly help me&amp;nbsp; it would be great help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Query I tried:&lt;/P&gt;
&lt;P&gt;index=perf-*** host=****** source=/home/JenkinsSlave/JenkinsSlaveDir/workspace/*/project/logs/*SamplerErrors.xml | eval tn=replace(tn,"\d{1}\d+","") | rex d"&amp;lt;responseData class=\"java\.lang\.String\"&amp;gt;?{(?P&amp;lt;Response_Data1&amp;gt;[\w\D]+)&amp;lt;\/java.net.URL&amp;gt;" | dedup tn | stats count by tn,Response_Data1 |rex field=Response_Data1 max_match=2 "&amp;lt;responseData class=\"java\.lang\.String\"&amp;gt;?{(?P&amp;lt;Response_Data2&amp;gt;[\w\D]+)&amp;lt;\/java.net.URL&amp;gt;" | eval Response_Data2=if(mvcount(Response_Data2)=2, mvindex(Response_Data2, 2), Response_Data2)&lt;/P&gt;
&lt;P&gt;XML Data:&lt;/P&gt;
&lt;P&gt;--------------------&lt;/P&gt;
&lt;P&gt;&amp;lt;/sample&amp;gt;&lt;BR /&gt;&amp;lt;sample t="48" lt="0" ts="1662725857475" s="true" lb="HealthCheck_Subscription_S04_LookupInvoiceStatus_T01_LookupInvoiceStatus" rc="200" rm="Number of samples in transaction : 1, number of failing samples : 0" &lt;STRONG&gt;tn="Subscription_S04_LookupInvoiceStatus&lt;/STRONG&gt; 1-1" dt="" by="465" ng="1" na="1"&amp;gt;&lt;BR /&gt;&amp;lt;httpSample t="48" lt="48" ts="1662725858479" s="true" lb="EDI2" rc="200" rm="OK" tn="Subscription_S04_LookupInvoiceStatus 1-1" dt="text" by="465" ng="1" na="1"&amp;gt;&lt;BR /&gt;&amp;lt;responseHeader class="java.lang.String"&amp;gt;HTTP/1.1 200 OK Date: Fri, 09 Sep 2022 12:17:38 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Encoding Content-Encoding: gzip &amp;lt;/responseHeader&amp;gt;&lt;BR /&gt;&amp;lt;requestHeader class="java.lang.String"&amp;gt;Connection: keep-alive content-type: application/json Authorization: Bearer test_***** Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 perftest: true Content-Length: 40 Host: stage-subscription.teslamotors.com X-LocalAddress: /10.33.51.205 &amp;lt;/requestHeader&amp;gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;responseData class="java.lang.String"&amp;gt;{"orderRefId":"****","productName":"***","country":"NL","invoiceInformation":[{"uniqueOrderId":"****","amount":**,"currency":null,"invoiceStatus":"**","dueDate":null,"cycleStartDate":"**","cycleEndDate":"*****","paymentDate":"****"}]}&amp;lt;/responseData&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;responseFile class="java.lang.String"/&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;cookies class="java.lang.String"/&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;method class="java.lang.String"&amp;gt;POST&amp;lt;/method&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;queryString class="java.lang.String"&amp;gt;{ "OrderRefId": "*****"}&amp;lt;/queryString&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Sep 2022 03:15:04 GMT</pubDate>
    <dc:creator>rpachamuthu</dc:creator>
    <dc:date>2022-09-12T03:15:04Z</dc:date>
    <item>
      <title>Help with Search in XML file-Multiple lines data for validation of HTTP response content validation for API calls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612669#M213013</link>
      <description>&lt;P&gt;I am new to Splunk query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to capture the&amp;nbsp; filed value of &lt;STRONG&gt;tn&lt;/STRONG&gt; "&lt;STRONG&gt;Subscription_S04_LookupInvoiceStatus" &lt;/STRONG&gt;and&lt;STRONG&gt; Response data(Highlighted bold in the below XML file)&lt;/STRONG&gt;&amp;nbsp;for the corresponding "&lt;STRONG&gt;tn&lt;/STRONG&gt;" filed value and display under statistics.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;"Subscription_S04_LookupInvoiceStatus" &lt;/STRONG&gt;value present multiple times in the XML file&amp;nbsp; &amp;nbsp;and &lt;STRONG&gt;Response data&lt;/STRONG&gt; for the corresponding "&lt;STRONG&gt;tn&lt;/STRONG&gt;" filed value, I want to query for unique one(Remove duplicates)&lt;/P&gt;
&lt;P&gt;I tried the below query, but its not pulling the response Data.&lt;/P&gt;
&lt;P&gt;Kindly help me&amp;nbsp; it would be great help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Query I tried:&lt;/P&gt;
&lt;P&gt;index=perf-*** host=****** source=/home/JenkinsSlave/JenkinsSlaveDir/workspace/*/project/logs/*SamplerErrors.xml | eval tn=replace(tn,"\d{1}\d+","") | rex d"&amp;lt;responseData class=\"java\.lang\.String\"&amp;gt;?{(?P&amp;lt;Response_Data1&amp;gt;[\w\D]+)&amp;lt;\/java.net.URL&amp;gt;" | dedup tn | stats count by tn,Response_Data1 |rex field=Response_Data1 max_match=2 "&amp;lt;responseData class=\"java\.lang\.String\"&amp;gt;?{(?P&amp;lt;Response_Data2&amp;gt;[\w\D]+)&amp;lt;\/java.net.URL&amp;gt;" | eval Response_Data2=if(mvcount(Response_Data2)=2, mvindex(Response_Data2, 2), Response_Data2)&lt;/P&gt;
&lt;P&gt;XML Data:&lt;/P&gt;
&lt;P&gt;--------------------&lt;/P&gt;
&lt;P&gt;&amp;lt;/sample&amp;gt;&lt;BR /&gt;&amp;lt;sample t="48" lt="0" ts="1662725857475" s="true" lb="HealthCheck_Subscription_S04_LookupInvoiceStatus_T01_LookupInvoiceStatus" rc="200" rm="Number of samples in transaction : 1, number of failing samples : 0" &lt;STRONG&gt;tn="Subscription_S04_LookupInvoiceStatus&lt;/STRONG&gt; 1-1" dt="" by="465" ng="1" na="1"&amp;gt;&lt;BR /&gt;&amp;lt;httpSample t="48" lt="48" ts="1662725858479" s="true" lb="EDI2" rc="200" rm="OK" tn="Subscription_S04_LookupInvoiceStatus 1-1" dt="text" by="465" ng="1" na="1"&amp;gt;&lt;BR /&gt;&amp;lt;responseHeader class="java.lang.String"&amp;gt;HTTP/1.1 200 OK Date: Fri, 09 Sep 2022 12:17:38 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Encoding Content-Encoding: gzip &amp;lt;/responseHeader&amp;gt;&lt;BR /&gt;&amp;lt;requestHeader class="java.lang.String"&amp;gt;Connection: keep-alive content-type: application/json Authorization: Bearer test_***** Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 perftest: true Content-Length: 40 Host: stage-subscription.teslamotors.com X-LocalAddress: /10.33.51.205 &amp;lt;/requestHeader&amp;gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;responseData class="java.lang.String"&amp;gt;{"orderRefId":"****","productName":"***","country":"NL","invoiceInformation":[{"uniqueOrderId":"****","amount":**,"currency":null,"invoiceStatus":"**","dueDate":null,"cycleStartDate":"**","cycleEndDate":"*****","paymentDate":"****"}]}&amp;lt;/responseData&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;responseFile class="java.lang.String"/&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;cookies class="java.lang.String"/&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;method class="java.lang.String"&amp;gt;POST&amp;lt;/method&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;queryString class="java.lang.String"&amp;gt;{ "OrderRefId": "*****"}&amp;lt;/queryString&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 03:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612669#M213013</guid>
      <dc:creator>rpachamuthu</dc:creator>
      <dc:date>2022-09-12T03:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Search in XML file-Multiple lines data for validation of HTTP response content validation for API calls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612674#M213015</link>
      <description>&lt;P data-unlink="true"&gt;The first rule is not try to extract structured data using rex. &amp;nbsp;Either set the sourcetype to extract XML automatically (see KV_MODE in&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf#Field_extraction_configuration" target="_blank" rel="noopener"&gt;Field extraction configuration&lt;/A&gt;), or if XML is not automatically extracted, use&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt; command. &amp;nbsp;After that, you should have a field&amp;nbsp;&lt;FONT face="andale mono,times"&gt;sample{@tn}&lt;/FONT&gt;&amp;nbsp;ready to be used, together with a plethora of other fields structured in the XML.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 04:34:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612674#M213015</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-09-12T04:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Search in XML file-Multiple lines data for validation of HTTP response content validation for API calls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612723#M213025</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for your response,&lt;/P&gt;&lt;P&gt;I am having challenges for creating field for "Response Data" and display next to&amp;nbsp; "tn" field&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me with any sample query if possible&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 10:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612723#M213025</guid>
      <dc:creator>rpachamuthu</dc:creator>
      <dc:date>2022-09-12T10:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Search in XML file-Multiple lines data for validation of HTTP response content validation for API calls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612809#M213050</link>
      <description>&lt;P&gt;Could you please someone help me&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 02:59:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612809#M213050</guid>
      <dc:creator>rpachamuthu</dc:creator>
      <dc:date>2022-09-13T02:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Search in XML file-Multiple lines data for validation of HTTP response content validation for API calls</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612815#M213052</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249357"&gt;@rpachamuthu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Please try below sample;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=perf-*** host=****** source=/home/JenkinsSlave/JenkinsSlaveDir/workspace/*/project/logs/*SamplerErrors.xml
| spath 
| rename *{@*} as *_* 
| stats values("sample.httpSample.responseData") as responseData by sample_tn&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Sep 2022 04:27:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Search-in-XML-file-Multiple-lines-data-for-validation/m-p/612815#M213052</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2022-09-13T04:27:36Z</dc:date>
    </item>
  </channel>
</rss>

