<?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 not getting the time difference in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438150#M173244</link>
    <description>&lt;P&gt;Hi splunkers,&lt;/P&gt;

&lt;P&gt;i m trying to calculate the time differece in minutes between the two fields &lt;STRONG&gt;sla_time&lt;/STRONG&gt;  and &lt;STRONG&gt;FILE_ARRIVALTIME&lt;/STRONG&gt; . It seems the correct query for me , but not getting the time difference value from the following query. Any of you can help?&lt;/P&gt;

&lt;P&gt;query:&lt;BR /&gt;
| inputlookup SLA.csv |table SOR_NAME SOR_TDQ_FAIL_SLA_THRESHOLD|eval sla_time =replace (SOR_TDQ_FAIL_SLA_THRESHOLD,"^\w++\d" ,strftime(now(), "%Y-%m-%d"))|eval sla_time=replace (sla_time,","," ") |table SOR_NAME sla_time |join type=outer SOR_NAME [search index=xxx|rex "info\s:\s+{4}\sSTARTED\s+{4}\sJob run_ingest_(?\w+)&lt;EM&gt;(?\d+-\d+-\d+-\d+-\d+-\d+)&lt;/EM&gt;"|rex field=Datafeed_name "^(?\w{2,5})_(?\w+)$" | eval FILE_ARRIVALTIME = strftime(strptime(start_time,"%Y-%m-%d-%H-%M-%S") ,"%Y-%m-%d %H:%M:%S") | eval FILE_ARRIVALTIME = substr(FILE_ARRIVALTIME, 1, len(FILE_ARRIVALTIME)-3) | eval FILE_ARRIVALTIME_epoch=strptime(FILE_ARRIVALTIME,"%Y-%m-%d %H:%M") |fields SOR_NAME FEED_NAME FILE_ARRIVALTIME FILE_ARRIVALTIME_epoch] |eval sla_time_epoch = strptime(sla_time,"%Y-%m-%d %H:%M")| eval time_diff = tostring((FILE_ARRIVALTIME_epoch-sla_time_epoch), "duration") |table SOR_NAME FEED_NAME sla_time FILE_ARRIVALTIME  time_diff&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:01:42 GMT</pubDate>
    <dc:creator>pench2k19</dc:creator>
    <dc:date>2020-09-29T23:01:42Z</dc:date>
    <item>
      <title>not getting the time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438150#M173244</link>
      <description>&lt;P&gt;Hi splunkers,&lt;/P&gt;

&lt;P&gt;i m trying to calculate the time differece in minutes between the two fields &lt;STRONG&gt;sla_time&lt;/STRONG&gt;  and &lt;STRONG&gt;FILE_ARRIVALTIME&lt;/STRONG&gt; . It seems the correct query for me , but not getting the time difference value from the following query. Any of you can help?&lt;/P&gt;

&lt;P&gt;query:&lt;BR /&gt;
| inputlookup SLA.csv |table SOR_NAME SOR_TDQ_FAIL_SLA_THRESHOLD|eval sla_time =replace (SOR_TDQ_FAIL_SLA_THRESHOLD,"^\w++\d" ,strftime(now(), "%Y-%m-%d"))|eval sla_time=replace (sla_time,","," ") |table SOR_NAME sla_time |join type=outer SOR_NAME [search index=xxx|rex "info\s:\s+{4}\sSTARTED\s+{4}\sJob run_ingest_(?\w+)&lt;EM&gt;(?\d+-\d+-\d+-\d+-\d+-\d+)&lt;/EM&gt;"|rex field=Datafeed_name "^(?\w{2,5})_(?\w+)$" | eval FILE_ARRIVALTIME = strftime(strptime(start_time,"%Y-%m-%d-%H-%M-%S") ,"%Y-%m-%d %H:%M:%S") | eval FILE_ARRIVALTIME = substr(FILE_ARRIVALTIME, 1, len(FILE_ARRIVALTIME)-3) | eval FILE_ARRIVALTIME_epoch=strptime(FILE_ARRIVALTIME,"%Y-%m-%d %H:%M") |fields SOR_NAME FEED_NAME FILE_ARRIVALTIME FILE_ARRIVALTIME_epoch] |eval sla_time_epoch = strptime(sla_time,"%Y-%m-%d %H:%M")| eval time_diff = tostring((FILE_ARRIVALTIME_epoch-sla_time_epoch), "duration") |table SOR_NAME FEED_NAME sla_time FILE_ARRIVALTIME  time_diff&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438150#M173244</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2020-09-29T23:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: not getting the time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438151#M173245</link>
      <description>&lt;P&gt;@vnravikumar &lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 08:44:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438151#M173245</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2019-01-31T08:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: not getting the time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438152#M173246</link>
      <description>&lt;P&gt;@pench2k19 &lt;/P&gt;

&lt;P&gt;Can you please confirm below search will have data in all fields ( &lt;CODE&gt;SOR_NAME FEED_NAME sla_time FILE_ARRIVALTIME FILE_ARRIVALTIME_epoch sla_time_epoch&lt;/CODE&gt;) ??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup SLA.csv 
| table SOR_NAME SOR_TDQ_FAIL_SLA_THRESHOLD 
| eval sla_time =replace (SOR_TDQ_FAIL_SLA_THRESHOLD,"^\w++\d" ,strftime(now(), "%Y-%m-%d")) 
| eval sla_time=replace (sla_time,","," ") 
| table SOR_NAME sla_time 
| join type=outer SOR_NAME 
    [ search index=xxx 
    | rex "info\s:\s+{4}\sSTARTED\s+{4}\sJob run_ingest_(?\w+)(?\d+-\d+-\d+-\d+-\d+-\d+)" 
    | rex field=Datafeed_name "^(?\w{2,5})_(?\w+)$" 
    | eval FILE_ARRIVALTIME = strftime(strptime(start_time,"%Y-%m-%d-%H-%M-%S") ,"%Y-%m-%d %H:%M:%S") 
    | eval FILE_ARRIVALTIME = substr(FILE_ARRIVALTIME, 1, len(FILE_ARRIVALTIME)-3) 
    | eval FILE_ARRIVALTIME_epoch=strptime(FILE_ARRIVALTIME,"%Y-%m-%d %H:%M") 
    | fields SOR_NAME FEED_NAME FILE_ARRIVALTIME FILE_ARRIVALTIME_epoch] 
| eval sla_time_epoch = strptime(sla_time,"%Y-%m-%d %H:%M") 
| table SOR_NAME FEED_NAME sla_time FILE_ARRIVALTIME FILE_ARRIVALTIME_epoch sla_time_epoch 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 13:31:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438152#M173246</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-01-31T13:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: not getting the time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438153#M173247</link>
      <description>&lt;P&gt;yes it does have all the fields....&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 14:05:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438153#M173247</guid>
      <dc:creator>pench2k19</dc:creator>
      <dc:date>2019-01-31T14:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: not getting the time difference</title>
      <link>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438154#M173248</link>
      <description>&lt;P&gt;Can you please share sample results ( first 5 rec) ?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 14:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/not-getting-the-time-difference/m-p/438154#M173248</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-01-31T14:15:18Z</dc:date>
    </item>
  </channel>
</rss>

