<?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: update humar readable Time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451939#M127965</link>
    <description>&lt;P&gt;Could you please post what you're getting in the tokens as values ? your syntax seems correct&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2019 12:00:54 GMT</pubDate>
    <dc:creator>DavidHourani</dc:creator>
    <dc:date>2019-05-09T12:00:54Z</dc:date>
    <item>
      <title>update humar readable Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451938#M127964</link>
      <description>&lt;P&gt;Hi, I am passing human readable time using URL to my dashboard and looking to change this time by 1 hr earlier.&lt;/P&gt;

&lt;P&gt;Example &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Passing Time in URL : 2019-05-09T10:30:00.000+02:00
Expectation :  2019-05-09T09:30:00.000+02:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tried converting it to epoch and subtract 3600. After converted it back to same format. but not working as per expectation.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;| makeresults count=1 annotate=false &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;condition match="match($ALERT_TOKEN$,&amp;amp;quot;true&amp;amp;quot;)"&amp;gt;
         &amp;lt;eval token="epoch_time"&amp;gt;strptime($url_time$,"%Y-%m-%dT%H:%M:%S")-3600&amp;lt;/eval&amp;gt;
         &amp;lt;eval token="final_time"&amp;gt;strftime($epoch_time$,"%Y-%m-%dT%H:%M:%S.%3f%z")&amp;lt;/eval&amp;gt;
      &amp;lt;/condition&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This logic works in search but not in dashboard code. Any suggestion what I am missing here ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval TIME="2019-05-09T10:30:00.000+02:00" 
| eval TIME1=strptime(TIME,"%Y-%m-%dT%H:%M:%S")-3600 
| eval TIME2=strftime(TIME1,"%Y-%m-%dT%H:%M:%S.%3f%z") 
| table TIME TIME1 TIME2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 May 2019 10:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451938#M127964</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2019-05-09T10:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: update humar readable Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451939#M127965</link>
      <description>&lt;P&gt;Could you please post what you're getting in the tokens as values ? your syntax seems correct&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 12:00:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451939#M127965</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-09T12:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: update humar readable Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451940#M127966</link>
      <description>&lt;P&gt;Hi @agoyal,&lt;/P&gt;

&lt;P&gt;I tried testing around with the token and it seemed to work best when the value sent in the original &lt;CODE&gt;$url_time$&lt;/CODE&gt; is in epoch. It would be easier for you to send that vs a human readable date.&lt;/P&gt;

&lt;P&gt;If that's not possible then I recommend you first check the value you're getting in the &lt;CODE&gt;epoch_time&lt;/CODE&gt; token via &lt;CODE&gt;&amp;lt;eval token="epoch_time"&amp;gt;strptime($url_time$,"%Y-%m-%dT%H:%M:%S")-3600&amp;lt;/eval&amp;gt;&lt;/CODE&gt; by using &lt;CODE&gt;$epoch_time$&lt;/CODE&gt; in a dashboard title or as follows &lt;CODE&gt;|makeresults|eval A=$epoch_time$&lt;/CODE&gt; this will make troubleshooting way easier for you.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 12:25:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451940#M127966</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-09T12:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: update humar readable Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451941#M127967</link>
      <description>&lt;P&gt;Thanks but url_time is generated in alert using $job.earliest_time$ so don't think possible to use epoch.&lt;BR /&gt;
converting to epoch time is working fine it just converting back to human readable is not working.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451941#M127967</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2020-09-30T00:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: update humar readable Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451942#M127968</link>
      <description>&lt;P&gt;In that case remove the strptime because $job.earliest_time$ is already in epoch. So no need to reconvert it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; make it $url_time$ -3600 &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:27:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451942#M127968</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2020-09-30T00:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: update humar readable Time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451943#M127969</link>
      <description>&lt;P&gt;no its not in epoch timeformat.&lt;/P&gt;

&lt;P&gt;Defined it Email alert&lt;BR /&gt;
?&amp;amp;host_token=$result.host_token$&amp;amp;form.time_token.earliest=$job.earliestTime$&amp;amp;form.time_token.latest=$job.latestTime$&amp;amp;Log_or_Live_token=Live&lt;/P&gt;

&lt;P&gt;Output:&lt;BR /&gt;
?&amp;amp;host_token=QCST_RSAT_V42&amp;amp;form.time_token.earliest=2019-05-09T10:45:00.000+02:00&amp;amp;form.time_token.latest=2019-05-09T10:55:00.000+02:00&amp;amp;Log_or_Live_token=Live&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:28:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/update-humar-readable-Time/m-p/451943#M127969</guid>
      <dc:creator>AKG1_old1</dc:creator>
      <dc:date>2020-09-30T00:28:41Z</dc:date>
    </item>
  </channel>
</rss>

