<?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 to get an epoch time for $client_time.latest$ in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540980#M153126</link>
    <description>&lt;P&gt;This was perfect, thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2021 09:53:11 GMT</pubDate>
    <dc:creator>trapper_dave</dc:creator>
    <dc:date>2021-02-23T09:53:11Z</dc:date>
    <item>
      <title>How to get an epoch time for $client_time.latest$</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540151#M152785</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a dashboard with a dropdown form allowing users to select the time period they wish to analyse.&lt;/P&gt;&lt;P&gt;I am looking to capture the latest time token of the period in epoch format but I am running into issues.&lt;/P&gt;&lt;P&gt;I have found that if the end time is 'now', then I can use time() however this doesn't work for when the end time is in the past (i.e. yesterday, previous week or previous year).&lt;/P&gt;&lt;P&gt;Can anyone assist me in figuring this out?&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 19:03:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540151#M152785</guid>
      <dc:creator>trapper_dave</dc:creator>
      <dc:date>2021-02-16T19:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an epoch time for $client_time.latest$</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540169#M152789</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231576"&gt;@trapper_dave&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The technique is to set up a hidden panel with a search that uses the addinfo command to get the latest time for the search and then use a &amp;lt;done&amp;gt; clause to set tokens based on that epoch.&lt;/P&gt;&lt;P&gt;See the attached dashboard&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Time Pickers 2&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;&amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;input type="time" token="client"&amp;gt;
        &amp;lt;label&amp;gt;Select Time&amp;lt;/label&amp;gt;
        &amp;lt;default&amp;gt;
          &amp;lt;earliest&amp;gt;-1d@d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;@d&amp;lt;/latest&amp;gt;
        &amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;table depends="$show_hidden$"&amp;gt;
        &amp;lt;title&amp;gt;This simple search - is hidden - but is used to calculate the relative time for the second table&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
| addinfo
          &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$client.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$client.latest$&amp;lt;/latest&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;set token="search_latest"&amp;gt;$result.info_max_time$&amp;lt;/set&amp;gt;
            &amp;lt;eval token="search_latest_fmt"&amp;gt;strftime($result.info_max_time$, "%F %T")&amp;lt;/eval&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;
            | makeresults
            | eval Selected_Time_Input=$client.latest|s$
            | eval Selected_Time_ISO=$search_latest_fmt|s$
            | eval Selected_Time_Epoch=$search_latest$
            | table Selected_Time_Input Selected_Time_ISO Selected_Time_Epoch
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 21:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540169#M152789</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-02-16T21:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an epoch time for $client_time.latest$</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540980#M153126</link>
      <description>&lt;P&gt;This was perfect, thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 09:53:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540980#M153126</guid>
      <dc:creator>trapper_dave</dc:creator>
      <dc:date>2021-02-23T09:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an epoch time for $client_time.latest$</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540987#M153131</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231576"&gt;@trapper_dave&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Glad it helped you. Can you mark the answer as a solution for others.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 10:43:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-epoch-time-for-client-time-latest/m-p/540987#M153131</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-02-23T10:43:13Z</dc:date>
    </item>
  </channel>
</rss>

