<?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: Need get last event occurred time of each day in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545519#M154536</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/182413"&gt;@paragvidhi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;To get difference you should calculate the diff before time conversions. Please try below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search A
| eval Date=strftime(_time, "%d/%m/%Y")
| stats latest(_time) AS Latest by Date
| join Date
[search search B
| eval Date=strftime(_time, "%d/%m/%Y")
| stats earliest(_time) AS Earliest by Date
]
| eval time_diff= Endtime_mail - starttime_mail
| eval time_diff=tostring(time_diff,"duration") 
| eval starttime_mail=strftime(Earliest,"%Y/%m/%d %H:%M:%S")
| eval Endtime_mail=strftime(Latest,"%Y/%m/%d %H:%M:%S")
| table starttime_mail,Endtime_mail, time_diff&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 26 Mar 2021 06:20:53 GMT</pubDate>
    <dc:creator>scelikok</dc:creator>
    <dc:date>2021-03-26T06:20:53Z</dc:date>
    <item>
      <title>Need get last event occurred time of each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545443#M154491</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I would like to get last event occurred time of each day, my searching window area is last 30 days.&lt;/P&gt;&lt;P&gt;For example : If my query return 3 events for day1 and 5 events for day 2 than I need only two event in output.&amp;nbsp;&lt;BR /&gt;last event time of day 1 and last event time of day 2 and so on.&lt;/P&gt;&lt;P&gt;I tried to get that with help of table command.&amp;nbsp; it works for me. but I need to do that without using of table command.&amp;nbsp;&lt;BR /&gt;worth if you could help me to find rename or create duplicate field of date_mday and _time&lt;BR /&gt;&lt;BR /&gt;search | table date_mday, _time | dedup date_mday | sort date_mday.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 16:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545443#M154491</guid>
      <dc:creator>paragvidhi</dc:creator>
      <dc:date>2021-03-25T16:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need get last event occurred time of each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545445#M154493</link>
      <description>&lt;P&gt;Why don't you want to use the table command?&lt;/P&gt;&lt;P&gt;What happens if you just remove the table command?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 16:31:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545445#M154493</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-03-25T16:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need get last event occurred time of each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545446#M154494</link>
      <description>&lt;P&gt;Actually I need use that data to another search.&amp;nbsp;&lt;BR /&gt;so if i give you more details.&amp;nbsp; so I would like to get total time taken.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have two search A and B .&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In search A I will get only single event for each day. so I am consider event time as starttime.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;In search B I will get multiple event in a day. so the last event occurred on that day I consider endtime of that event.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now I need to display result like below.&amp;nbsp;&lt;BR /&gt;Date&amp;nbsp; starttime endtime timetaken(starttime-endtime)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 16:41:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545446#M154494</guid>
      <dc:creator>paragvidhi</dc:creator>
      <dc:date>2021-03-25T16:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need get last event occurred time of each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545456#M154503</link>
      <description>&lt;P&gt;If search A is purely to find the start and search B is from the same source, you could try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search | stats earliest_time(_time) as start latest_time(_time) as end by date_mday&lt;/LI-CODE&gt;&lt;P&gt;You could return these with every event by using eventstats instead of just stats if you still need the event data&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 17:56:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545456#M154503</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-03-25T17:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need get last event occurred time of each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545467#M154507</link>
      <description>&lt;P&gt;I got my query result in another way but its partial.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here I use below query.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;search A&lt;BR /&gt;| eval Date=strftime(_time, "%d/%m/%Y")&lt;BR /&gt;| stats latest(_time) AS Latest by Date&lt;BR /&gt;| eval Endtime_mail=strftime(Latest,"%Y/%m/%d %H:%M:%S")&lt;BR /&gt;| join Date&lt;BR /&gt;[search search B&lt;BR /&gt;| eval Date=strftime(_time, "%d/%m/%Y")&lt;BR /&gt;| stats earliest(_time) AS Earliest by Date&lt;BR /&gt;| eval starttime_mail=strftime(Earliest,"%Y/%m/%d %H:%M:%S")&lt;BR /&gt;]&lt;BR /&gt;| table starttime_mail,Endtime_mail&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 200px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13493i504652527D40321C/image-size/small?v=v2&amp;amp;px=200" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Now I am not able get date-time difference between starttime_mail and Endtime_mail.&amp;nbsp;&lt;BR /&gt;Difference should be like 1 day ,3 hour, 43 minute.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 19:09:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545467#M154507</guid>
      <dc:creator>paragvidhi</dc:creator>
      <dc:date>2021-03-25T19:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Need get last event occurred time of each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545519#M154536</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/182413"&gt;@paragvidhi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;To get difference you should calculate the diff before time conversions. Please try below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;search A
| eval Date=strftime(_time, "%d/%m/%Y")
| stats latest(_time) AS Latest by Date
| join Date
[search search B
| eval Date=strftime(_time, "%d/%m/%Y")
| stats earliest(_time) AS Earliest by Date
]
| eval time_diff= Endtime_mail - starttime_mail
| eval time_diff=tostring(time_diff,"duration") 
| eval starttime_mail=strftime(Earliest,"%Y/%m/%d %H:%M:%S")
| eval Endtime_mail=strftime(Latest,"%Y/%m/%d %H:%M:%S")
| table starttime_mail,Endtime_mail, time_diff&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Mar 2021 06:20:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545519#M154536</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-03-26T06:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need get last event occurred time of each day</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545522#M154539</link>
      <description>&lt;LI-CODE lang="markup"&gt;search A
| eval Date=strftime(_time, "%d/%m/%Y")
| stats latest(_time) AS Latest by Date
| join Date
[search search B
| eval Date=strftime(_time, "%d/%m/%Y")
| stats earliest(_time) AS Earliest by Date
]
| eval timediff=Latest-Earliest
| eval duration_mail=tostring(timediff,"duration")
| eval Endtime_mail=strftime(Latest,"%Y/%m/%d %H:%M:%S")
| eval starttime_mail=strftime(Earliest,"%Y/%m/%d %H:%M:%S")
| table starttime_mail,Endtime_mail,duration_mail&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Mar 2021 06:29:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-get-last-event-occurred-time-of-each-day/m-p/545522#M154539</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-03-26T06:29:32Z</dc:date>
    </item>
  </channel>
</rss>

