<?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: How do I get search start time and end time value ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521319#M146895</link>
    <description>Please try&lt;BR /&gt;&lt;BR /&gt;.... | stats .... earliest_time(_time) as eTime latest_time(_time) as lTime ....</description>
    <pubDate>Thu, 24 Sep 2020 16:06:47 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2020-09-24T16:06:47Z</dc:date>
    <item>
      <title>How do I get search start time and end time value ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521224#M146855</link>
      <description>&lt;P&gt;How do I get the&amp;nbsp; job-execution start time and job execution endtime of my&amp;nbsp; query as output of the query.&lt;BR /&gt;&lt;BR /&gt;index = some_index source = somesoure&lt;BR /&gt;| some_logic added here&lt;BR /&gt;| eval search_starttime =&amp;nbsp;&lt;SPAN&gt;$job.earliestTime$&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;| eval search_endtime =&amp;nbsp;&lt;SPAN&gt;$job.latestTime$&lt;BR /&gt;| table some_logic_output search_starttime search_endtime&lt;BR /&gt;&lt;BR /&gt;I am seeing no result for the&amp;nbsp;search_starttime and&amp;nbsp;search_endtime column in my table.&lt;BR /&gt;Any help ?&lt;BR /&gt;&lt;BR /&gt;What I mean here is, how do I get&amp;nbsp; the _time value for the earliest event and the _time value of my latest event of my search resultset ?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 16:00:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521224#M146855</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-09-24T16:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get search start time and end time value ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521306#M146885</link>
      <description>&lt;P&gt;Try addinfo.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = some_index source = somesoure
| some_logic added here
| addinfo
| eval search_starttime = info_min_time
| eval search_endtime = info_max_time
| table some_logic_output search_starttime search_endtime&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 24 Sep 2020 15:30:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521306#M146885</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-24T15:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get search start time and end time value ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521316#M146892</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;It gives me search_starttime as 0 and search_endtime as+infinity.&amp;nbsp; &amp;nbsp;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;Sorry , for the confusion.&lt;BR /&gt;But what I meant is, how do I get&amp;nbsp; the _time value for the earliest event and the _time value of my latest event of my search result.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 15:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521316#M146892</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-09-24T15:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get search start time and end time value ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521319#M146895</link>
      <description>Please try&lt;BR /&gt;&lt;BR /&gt;.... | stats .... earliest_time(_time) as eTime latest_time(_time) as lTime ....</description>
      <pubDate>Thu, 24 Sep 2020 16:06:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521319#M146895</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2020-09-24T16:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get search start time and end time value ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521324#M146899</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;But my problem is if I use stats then that value isn't get dynamically passed to the macro.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;search index = index_name source = source_name&lt;BR /&gt;| fields + bio, _time&lt;BR /&gt;|&lt;SPAN&gt;&amp;nbsp;stats&amp;nbsp; earliest_time(_time) as eTime latest_time(_time) as lTime&lt;BR /&gt;| eval Proj_Name = "my big project"&lt;BR /&gt;| `my_Macro(Proj_name, eTime, lTime)`&lt;BR /&gt;|table proj_value , proj_date&lt;BR /&gt;&lt;BR /&gt;In the above case the macro doesn't get invoked.&lt;BR /&gt;&lt;BR /&gt;However if I change something like below then the macro works and I get the desired result.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;search index = index_name source = source_name&lt;BR /&gt;| fields + bio, _time&lt;BR /&gt;|&amp;nbsp;eval eTime=6735475120.999&lt;BR /&gt;|eval lTime=6542213344.976&lt;BR /&gt;| eval Proj_Name = "my big project"&lt;BR /&gt;| `my_Macro(Proj_name, eTime, lTime)`&lt;BR /&gt;|table proj_value , proj_date&lt;BR /&gt;&lt;BR /&gt;It works with eval statement But I cannot hard-code the earliest and latest time. It has to to be dynamic based on the latest_event time and earliest event time. In the macro eTime and lTime values gets passed as earliest and latest values of a dashboard URL, and the Macro outputs that URL along with few other values.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 16:32:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/521324#M146899</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-09-24T16:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get search start time and end time value ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/612456#M212943</link>
      <description>&lt;P&gt;The eventstats command is what you're looking for. Please try:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;search index = index_name source = source_name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| fields + bio, _time&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;eventstats&lt;/STRONG&gt;&amp;nbsp; earliest_time(_time) as eTime latest_time(_time) as lTime&lt;BR /&gt;| eval Proj_Name = "my big project"&lt;BR /&gt;| `my_Macro(Proj_name, eTime, lTime)`&lt;BR /&gt;| table proj_value , proj_date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/8.2.2203/SearchReference/Eventstats" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;eventstats splunk doc&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 18:10:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-search-start-time-and-end-time-value/m-p/612456#M212943</guid>
      <dc:creator>pwilson</dc:creator>
      <dc:date>2022-09-08T18:10:52Z</dc:date>
    </item>
  </channel>
</rss>

