<?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: Query to get the values out of XML data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123569#M33366</link>
    <description>&lt;P&gt;eval end_time=strptime(move_end,"%Y-%m-%d %H:%M:%S.%3Q")  | eval start_time=strptime(move_file_start,"%Y-%m-%d %H:%M:%S.%3Q")   | eval diff=end_time-start_time  | eval move_time=strftime(diff, "%H:%M:%S.%3Q").. Please see this query and correct me&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 16:20:56 GMT</pubDate>
    <dc:creator>sushma7</dc:creator>
    <dc:date>2020-09-28T16:20:56Z</dc:date>
    <item>
      <title>Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123564#M33361</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Please find the below XML file:&lt;/P&gt;

&lt;P&gt;&lt;ENTRY&gt;&lt;BR /&gt;
    &lt;LOG_TIME&gt;20140401-05:39:58&lt;/LOG_TIME&gt;&lt;BR /&gt;
    &lt;DESCRIPTION&gt;&amp;lt;![CDATA[Connection established]]&amp;gt;&lt;/DESCRIPTION&gt;&lt;BR /&gt;
    &lt;SERVICE&gt;FTP&lt;/SERVICE&gt;&lt;BR /&gt;
    &lt;SESSIONID&gt;26875412&lt;/SESSIONID&gt;&lt;BR /&gt;
    &lt;TYPE&gt;0&lt;/TYPE&gt;    &lt;SEVERITY&gt;0&lt;/SEVERITY&gt;&lt;BR /&gt;
    &lt;LSTNCONNADDR&gt;153.71.45.1:21&lt;/LSTNCONNADDR&gt;&lt;BR /&gt;
    &lt;CLICONNADDR&gt;153.71.45.109:53828&lt;/CLICONNADDR&gt;&lt;BR /&gt;
    &lt;CMD&gt;start&lt;/CMD&gt;&lt;BR /&gt;
    &lt;SGUID&gt;F34F6ECC-6A58-4577-FE93-1F7F7C4D4C1D&lt;/SGUID&gt;&lt;BR /&gt;
  &lt;/ENTRY&gt;&lt;BR /&gt;
  &lt;ENTRY&gt;&lt;BR /&gt;
    &lt;LOG_TIME&gt;20140401-05:40:11&lt;/LOG_TIME&gt;&lt;BR /&gt;
    &lt;DESCRIPTION&gt;&amp;lt;![CDATA[logon success (110001001)]]&amp;gt;&lt;/DESCRIPTION&gt;&lt;BR /&gt;
    &lt;SERVICE&gt;FTP&lt;/SERVICE&gt;&lt;BR /&gt;
    &lt;SESSIONID&gt;26875412&lt;/SESSIONID&gt;&lt;BR /&gt;
    &lt;TYPE&gt;1&lt;/TYPE&gt;    &lt;SEVERITY&gt;1&lt;/SEVERITY&gt;&lt;BR /&gt;
    &lt;USER&gt;110001001&lt;/USER&gt;&lt;BR /&gt;
    &lt;HOST&gt;sep03vvm401.mdccommonldap.com&lt;/HOST&gt;&lt;BR /&gt;
    &lt;LSTNCONNADDR&gt;153.71.45.1:21&lt;/LSTNCONNADDR&gt;&lt;BR /&gt;
    &lt;CLICONNADDR&gt;153.71.45.109:53828&lt;/CLICONNADDR&gt;&lt;BR /&gt;
    &lt;CMD&gt;PASS&lt;/CMD&gt;&lt;BR /&gt;
    &lt;PARAMS&gt;&amp;lt;![CDATA[*****]]&amp;gt;&lt;/PARAMS&gt;&lt;BR /&gt;
    &lt;ERRNUM&gt;220&lt;/ERRNUM&gt;&lt;BR /&gt;
    &lt;SGUID&gt;F34F6ECC-6A58-4577-FE93-1F7F7C4D4C1D&lt;/SGUID&gt;&lt;BR /&gt;
  &lt;/ENTRY&gt;&lt;BR /&gt;
  &lt;ENTRY&gt;&lt;BR /&gt;
    &lt;LOG_TIME&gt;20140401-05:40:12&lt;/LOG_TIME&gt;&lt;BR /&gt;
    &lt;DESCRIPTION&gt;&amp;lt;![CDATA[]]&amp;gt;&lt;/DESCRIPTION&gt;&lt;BR /&gt;
    &lt;SERVICE&gt;FTP&lt;/SERVICE&gt;&lt;BR /&gt;
    &lt;SESSIONID&gt;26875412&lt;/SESSIONID&gt;&lt;BR /&gt;
    &lt;TYPE&gt;1&lt;/TYPE&gt;    &lt;SEVERITY&gt;0&lt;/SEVERITY&gt;&lt;BR /&gt;
    &lt;USER&gt;110001001&lt;/USER&gt;&lt;BR /&gt;
    &lt;HOST&gt;sep03vvm401.mdccommonldap.com&lt;/HOST&gt;&lt;BR /&gt;
    &lt;LSTNCONNADDR&gt;153.71.45.1:21&lt;/LSTNCONNADDR&gt;&lt;BR /&gt;
    &lt;CLICONNADDR&gt;153.71.45.109:53828&lt;/CLICONNADDR&gt;&lt;BR /&gt;
    &lt;CMD&gt;STOR&lt;/CMD&gt;&lt;BR /&gt;
    &lt;PARAMS&gt;&amp;lt;![CDATA[FDD_110001001_110001000_20140401_055542_20140401_3_201404010555421515_P.XCF]]&amp;gt;&lt;/PARAMS&gt;&lt;BR /&gt;
    &lt;ABSFILE&gt;&amp;lt;![CDATA[D:\Program Files\NCR\ECPIX\Data\SystemIn\users\110001001\FDD_110001001_110001000_20140401_055542_20140401_3_201404010555421515_P.XCF]]&amp;gt;&lt;/ABSFILE&gt;&lt;BR /&gt;
    &lt;FILESIZE&gt;86692&lt;/FILESIZE&gt;&lt;BR /&gt;
    &lt;TRANSTIME&gt;187&lt;/TRANSTIME&gt;&lt;BR /&gt;
    &lt;SGUID&gt;F34F6ECC-6A58-4577-FE93-1F7F7C4D4C1D&lt;/SGUID&gt;&lt;BR /&gt;
  &lt;/ENTRY&gt;&lt;BR /&gt;
  &lt;ENTRY&gt;&lt;BR /&gt;
    &lt;LOG_TIME&gt;20140401-05:40:12&lt;/LOG_TIME&gt;&lt;BR /&gt;
    &lt;DESCRIPTION&gt;&amp;lt;![CDATA[Connection closed]]&amp;gt;&lt;/DESCRIPTION&gt;&lt;BR /&gt;
    &lt;SERVICE&gt;FTP&lt;/SERVICE&gt;&lt;BR /&gt;
    &lt;SESSIONID&gt;26875412&lt;/SESSIONID&gt;&lt;BR /&gt;
    &lt;TYPE&gt;1&lt;/TYPE&gt;    &lt;SEVERITY&gt;0&lt;/SEVERITY&gt;&lt;BR /&gt;
    &lt;USER&gt;110001001&lt;/USER&gt;&lt;BR /&gt;
    &lt;HOST&gt;sep03vvm401.mdccommonldap.com&lt;/HOST&gt;&lt;BR /&gt;
    &lt;LSTNCONNADDR&gt;153.71.45.1:21&lt;/LSTNCONNADDR&gt;&lt;BR /&gt;
    &lt;CLICONNADDR&gt;153.71.45.109:53828&lt;/CLICONNADDR&gt;&lt;BR /&gt;
    &lt;CMD&gt;QUIT&lt;/CMD&gt;&lt;BR /&gt;
    &lt;SGUID&gt;F34F6ECC-6A58-4577-FE93-1F7F7C4D4C1D&lt;/SGUID&gt;&lt;BR /&gt;
  &lt;/ENTRY&gt;&lt;/P&gt;

&lt;P&gt;For this file I need a query to retrieve the values for &lt;BR /&gt;
 1. &lt;LSTNCONNADDR&gt;153.71.45.1:21&lt;/LSTNCONNADDR&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;&lt;CLICONNADDR&gt;153.71.45.109:53828&lt;/CLICONNADDR&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;&lt;USER&gt;110001001&lt;/USER&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;&lt;HOST&gt;sep03vvm401.mdccommonldap.com&lt;/HOST&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Start time for the request i.e. where the cmd start is mentioned.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;quit time for the request i.e. where the cmd quit is mentioned.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;difference between the start and quit time for request.&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Let me know if you need any more information.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Sushma.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123564#M33361</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2020-09-28T16:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123565#M33362</link>
      <description>&lt;P&gt;Look into using the spath command.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 08:03:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123565#M33362</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2014-04-08T08:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123566#M33363</link>
      <description>&lt;P&gt;I knew that we have to use spath so as to retrieve the xml values, but I am not clear as how to use in case of my above requirement.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 08:32:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123566#M33363</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2014-04-08T08:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123567#M33364</link>
      <description>&lt;P&gt;As a first step, make sure your XML is indexed as one entry tag per event with the log_time value used as Splunk timestamp.&lt;BR /&gt;
Once you've done that, using the &lt;CODE&gt;spath&lt;/CODE&gt; command will create fields like &lt;CODE&gt;entry.lstnconnaddr&lt;/CODE&gt;, &lt;CODE&gt;entry.cliconnaddr&lt;/CODE&gt;, and so on - you can use those as you normally would use fields.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 13:46:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123567#M33364</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-08T13:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123568#M33365</link>
      <description>&lt;P&gt;Ok, i wrote a query to calculate the difference between start and end time. In my XML file the start time is 19:42:48:305 and end time is 19:42:42:080, so the actual difference between them should be 00:00:06:225, but it is showing me as 20:00:06:225, why is it happening so?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 11:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123568#M33365</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2014-04-09T11:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123569#M33366</link>
      <description>&lt;P&gt;eval end_time=strptime(move_end,"%Y-%m-%d %H:%M:%S.%3Q")  | eval start_time=strptime(move_file_start,"%Y-%m-%d %H:%M:%S.%3Q")   | eval diff=end_time-start_time  | eval move_time=strftime(diff, "%H:%M:%S.%3Q").. Please see this query and correct me&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:20:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123569#M33366</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2020-09-28T16:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123570#M33367</link>
      <description>&lt;P&gt;For displaying the time I recommend &lt;EM&gt;not&lt;/EM&gt; using &lt;CODE&gt;strftime()&lt;/CODE&gt;. That expects an epoch timestamp, ie seconds since January 1st, 1970 UTC. I assume you're on UTC-4 (EDT?), which shows an epoch value of 6 as four hours before midnight (plus 6 seconds) and drops the December 31st, 1969 due to the &lt;CODE&gt;strftime()&lt;/CODE&gt; format.&lt;/P&gt;

&lt;P&gt;Instead, use Splunk's duration converter:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval end_time = strptime(...) | eval start_time = strptime(...) | eval diff = ... | eval move_time = tostring(diff, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Apr 2014 11:32:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123570#M33367</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T11:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123571#M33368</link>
      <description>&lt;P&gt;so just replace eval move_time=strftime(diff, "%H:%M:%S.%3Q") with eval move_time = tostring(diff, "%H:%M:%S.%3Q"). Is that right?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:20:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123571#M33368</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2020-09-28T16:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123572#M33369</link>
      <description>&lt;P&gt;Not quite, the &lt;CODE&gt;"duration"&lt;/CODE&gt; keyword is important for the &lt;CODE&gt;tostring()&lt;/CODE&gt; function. See &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.2/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.0.2/SearchReference/CommonEvalFunctions&lt;/A&gt; for reference.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 12:17:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123572#M33369</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T12:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123573#M33370</link>
      <description>&lt;P&gt;Yeah ok that worked out for me, but this query does not generate any statistical graph for me, is there a way to modify the query a bit so that i could be able to generate the query?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 12:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123573#M33370</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2014-04-09T12:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123574#M33371</link>
      <description>&lt;P&gt;What kind of statistics are you looking for?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 12:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123574#M33371</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T12:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123575#M33372</link>
      <description>&lt;P&gt;I mean to say I want to generate a graph out of it, i think modifying the query a bit may help out. Is it not?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 13:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123575#M33372</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2014-04-09T13:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123576#M33373</link>
      <description>&lt;P&gt;Any type of graph like bar, line or pie etc.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 13:29:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123576#M33373</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2014-04-09T13:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Query to get the values out of XML data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123577#M33374</link>
      <description>&lt;P&gt;You could for example append this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart avg(diff)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That'll produce a chart with the average diff value over time... no idea whether that's what you are looking for or not, there are endless numbers of different statistics you could want.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 16:17:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-get-the-values-out-of-XML-data/m-p/123577#M33374</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T16:17:36Z</dc:date>
    </item>
  </channel>
</rss>

