<?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 Query to retrieve the data from the logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118611#M31684</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;I have indexed system logs into the SPLUNK and it looks something like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[4/1/14 6:06:10:218 EDT] 000000a9 SystemOut O DEBUG | 2014-04-01 06:06:10.218 | | | | | | | Completed ftpHandler .doPost
[4/1/14 6:06:10:938 EDT] 000000a9 SystemOut O DEBUG | 2014-04-01 06:06:10.938 | | | | | | | In FTP recognize *****Reqtype:E****Filename:FDD_110001001_110001000_20140401_062210_20140401_3_201404010622421530_P.XCF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now here, I want to retrieve the time when the "Completed ftpHandler .doPost" operation has been completed say  2014-04-01 06:06:10.218  as per our example above and the time when the "requesttype:E" operation has been completed say  2014-04-01 06:06:10.938 .  Once I get these two time values then I should be able to calculate the difference between those two time period.&lt;/P&gt;

&lt;P&gt;I need query to be written in such a manner. Is that possible?&lt;/P&gt;

&lt;P&gt;Please help!&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Sushma.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Apr 2014 09:14:19 GMT</pubDate>
    <dc:creator>sushma7</dc:creator>
    <dc:date>2014-04-03T09:14:19Z</dc:date>
    <item>
      <title>Query to retrieve the data from the logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118611#M31684</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;I have indexed system logs into the SPLUNK and it looks something like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[4/1/14 6:06:10:218 EDT] 000000a9 SystemOut O DEBUG | 2014-04-01 06:06:10.218 | | | | | | | Completed ftpHandler .doPost
[4/1/14 6:06:10:938 EDT] 000000a9 SystemOut O DEBUG | 2014-04-01 06:06:10.938 | | | | | | | In FTP recognize *****Reqtype:E****Filename:FDD_110001001_110001000_20140401_062210_20140401_3_201404010622421530_P.XCF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now here, I want to retrieve the time when the "Completed ftpHandler .doPost" operation has been completed say  2014-04-01 06:06:10.218  as per our example above and the time when the "requesttype:E" operation has been completed say  2014-04-01 06:06:10.938 .  Once I get these two time values then I should be able to calculate the difference between those two time period.&lt;/P&gt;

&lt;P&gt;I need query to be written in such a manner. Is that possible?&lt;/P&gt;

&lt;P&gt;Please help!&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Sushma.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Apr 2014 09:14:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118611#M31684</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2014-04-03T09:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Query to retrieve the data from the logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118612#M31685</link>
      <description>&lt;P&gt;Hi sushma7,&lt;/P&gt;

&lt;P&gt;something like this will bring you ad-hoc results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YourBaseSearchHere 
| rex field="_raw" "(?=\s\|\s)(?&amp;lt;mydoPostTime&amp;gt;.+)(?&amp;lt;=\s(\|\s){7}Completed\sftpHandler\s\.doPost)" 
| rex field="_raw" "(?=\s\|\s)(?&amp;lt;mydoReqtypeTime&amp;gt;.+)(?&amp;lt;=\s(\|\s){7}In\sFTP\srecognize\s\*\*\*\*\*Reqtype:E\*\*\*\*)" 
| eval mydoPostTime_epoch=strptime(mydoPostTime,"%Y-%m-%d %H:%M:%S.%3Q") 
| eval mydoReqtypeTime_epoch=strptime(mydoReqtypeTime,"%Y-%m-%d %H:%M:%S.%3Q") 
| eval diff=mydoReqtypeTime_epoch-mydoPostTime_epoch 
| eval run_time=strftime(diff, "%H:%M:%S.%3Q")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You should setup this as &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.2/Knowledge/Addfieldsatsearchtime"&gt;field extraction&lt;/A&gt; so you will no longer need the &lt;CODE&gt;rex&lt;/CODE&gt; commands.&lt;/P&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 03 Apr 2014 10:33:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118612#M31685</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-03T10:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Query to retrieve the data from the logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118613#M31686</link>
      <description>&lt;P&gt;How to use filed extraction rather than this rex commands?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Apr 2014 10:38:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118613#M31686</guid>
      <dc:creator>sushma7</dc:creator>
      <dc:date>2014-04-03T10:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Query to retrieve the data from the logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118614#M31687</link>
      <description>&lt;P&gt;follow the link to the docs and the commands look good, just cross-checked&lt;/P&gt;</description>
      <pubDate>Thu, 03 Apr 2014 10:41:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Query-to-retrieve-the-data-from-the-logs/m-p/118614#M31687</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-03T10:41:09Z</dc:date>
    </item>
  </channel>
</rss>

