<?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: Difference between latest _time and a datetime field in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554236#M38501</link>
    <description>&lt;P&gt;I just have a Splunk timestamp for event logs (which I am considering in latest occurence). But the start time field is in the index and not a Splunk timestamp.&lt;/P&gt;&lt;P&gt;The stats command is not working for my start time field.&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jun 2021 09:46:17 GMT</pubDate>
    <dc:creator>schou87</dc:creator>
    <dc:date>2021-06-03T09:46:17Z</dc:date>
    <item>
      <title>Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554221#M38494</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I require a field which gives me the difference between the latest event timestamp and a date time field. I am using the below query but I am getting "No results found". Please help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;base_query | dedup RQ_ID |  stats latest(_time) AS latest_occurence | eval c_time=strptime(latest_occurence,"%m/%d/%y %H:%M:%S") | eval start_time=strptime(mvindex(START_TS,0),"%m/%d/%y %H:%M:%S") | eval diff=round ((c_time-setup_time)/3600,2) | table RQ_ID, diff&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 08:35:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554221#M38494</guid>
      <dc:creator>schou87</dc:creator>
      <dc:date>2021-06-03T08:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554223#M38495</link>
      <description>&lt;P&gt;last_occurence is an epoch time since it is the latest _time, therefore does not need to be parsed (strptime) into an epoch time. Try&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval diff=round ((last_occurence-setup_time)/3600,2)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 03 Jun 2021 08:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554223#M38495</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-03T08:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554225#M38496</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;I am getting the same message "No results found".&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 08:53:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554225#M38496</guid>
      <dc:creator>schou87</dc:creator>
      <dc:date>2021-06-03T08:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554227#M38497</link>
      <description>&lt;P&gt;The stats command is removing all the fields apart from last_occurence&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 08:55:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554227#M38497</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-03T08:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554228#M38498</link>
      <description>&lt;P&gt;What is it you are trying to do? dedup with pick up the first event in the pipeline for each RQ_ID, which is probably the latest since they are usually presented in descending order by time but it depends on what your base query is doing. If you want to process START_TS in anyway after the stats command, it needs to be passed through the stats command, same goes for RQ_ID.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 09:00:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554228#M38498</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-03T09:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554229#M38499</link>
      <description>&lt;P&gt;START_TS for each of RQ_ID is the start time for each of the request ids which will be different across different ids. I want to find the difference between each of the start time and latest timestamp when the latest logs is getting generated. So basically I want to know how long has the request ids been sitting on the system without getting processed basis different statuses that i have like pending, delivered, error.&lt;/P&gt;&lt;P&gt;So the output should be&lt;/P&gt;&lt;P&gt;RQ_ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; START_TS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Diff AS "Time Spent"&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 09:06:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554229#M38499</guid>
      <dc:creator>schou87</dc:creator>
      <dc:date>2021-06-03T09:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554231#M38500</link>
      <description>&lt;P&gt;So is there a first and last timestamp for each RQ_ID?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats earliest(_time) as start latest(_time) as end by RQ_ID
| eval diff=end-start&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 03 Jun 2021 09:17:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554231#M38500</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-03T09:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554236#M38501</link>
      <description>&lt;P&gt;I just have a Splunk timestamp for event logs (which I am considering in latest occurence). But the start time field is in the index and not a Splunk timestamp.&lt;/P&gt;&lt;P&gt;The stats command is not working for my start time field.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 09:46:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554236#M38501</guid>
      <dc:creator>schou87</dc:creator>
      <dc:date>2021-06-03T09:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554237#M38502</link>
      <description>&lt;P&gt;Does the deduped event contain everything that you need, including START_TS, as well as being the latest (first found) event for the RQ_ID?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 09:49:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554237#M38502</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-03T09:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554246#M38507</link>
      <description>&lt;P&gt;Yes it does. It is just giving the latest entry for a RQ_ID, rest everything is returned that I need.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 10:43:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554246#M38507</guid>
      <dc:creator>schou87</dc:creator>
      <dc:date>2021-06-03T10:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554251#M38511</link>
      <description>&lt;P&gt;OK so you don't need the stats or the parsing of _time, just use _time instead of c_time in your diff calculation&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;base_query 
| dedup RQ_ID 
| eval start_time=strptime(mvindex(START_TS,0),"%m/%d/%y %H:%M:%S") 
| eval diff=round ((_time-setup_time)/3600,2) 
| table RQ_ID, diff&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 03 Jun 2021 11:07:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554251#M38511</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-03T11:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest _time and a datetime field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554257#M38513</link>
      <description>&lt;P&gt;Thanks it worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 11:21:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Difference-between-latest-time-and-a-datetime-field/m-p/554257#M38513</guid>
      <dc:creator>schou87</dc:creator>
      <dc:date>2021-06-03T11:21:47Z</dc:date>
    </item>
  </channel>
</rss>

