<?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: Why strftime with %Z work differently  between query and eval + token in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366052#M165310</link>
    <description>&lt;P&gt;hi and thanks somesoni2&lt;/P&gt;

&lt;P&gt;This doc mentions "different behavior" for strftime. (personally, i see this behavior as a bug)&lt;BR /&gt;
I'm agree with you, but if we have to develop a huge trick just to convert timezone, i found that not user friendly.&lt;/P&gt;

&lt;P&gt;I think i have no other choose that implement a dummy query or other trick to do it.&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Régis&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2017 16:44:10 GMT</pubDate>
    <dc:creator>ralzate</dc:creator>
    <dc:date>2017-11-10T16:44:10Z</dc:date>
    <item>
      <title>Why strftime with %Z work differently  between query and eval + token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366050#M165308</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;In my dashboard, i saw a strange things with Timezone printing. In fact i have to make time conversion and show detail for a specific usage. I want to show date in a specific timezone (which could change dynamically). &lt;/P&gt;

&lt;P&gt;If I make calculation in query i have what i want.&lt;BR /&gt;
If I make calculation in token the result is not good.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;timeComponent&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;|makeresults
|eval out_time=strftime(time(),"%Z %z")
|table out_time
&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;set token="fromSearch"&amp;gt;$result.out_time$&amp;lt;/set&amp;gt;
            &amp;lt;eval token="fromEval"&amp;gt;strftime(time(),"%Z %z")&amp;lt;/eval&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;![alt text][1]         
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
   &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt; 
        &amp;lt;table border="0" cellpadding="12" cellspacing="0"&amp;gt;
          &amp;lt;tr&amp;gt;
            &amp;lt;td&amp;gt;Value in Search&amp;lt;/td&amp;gt;
            &amp;lt;td&amp;gt;[$fromSearch$]&amp;lt;/td&amp;gt;
          &amp;lt;/tr&amp;gt;
          &amp;lt;tr&amp;gt;
            &amp;lt;td&amp;gt;Value in eval&amp;lt;/td&amp;gt;
            &amp;lt;td&amp;gt;[$fromEval$]&amp;lt;/td&amp;gt;
          &amp;lt;/tr&amp;gt;
        &amp;lt;/table&amp;gt;  
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why the %Z is not working in the Eval ?&lt;BR /&gt;
My question is : Is it normal to have different results ? &lt;BR /&gt;
I have to make some time transformation and i wouldn't use fake (transformation using an other query, ...) just for changing timezone.&lt;/P&gt;

&lt;P&gt;Any idea ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Régis Alzaté&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 15:17:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366050#M165308</guid>
      <dc:creator>ralzate</dc:creator>
      <dc:date>2017-11-10T15:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why strftime with %Z work differently  between query and eval + token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366051#M165309</link>
      <description>&lt;P&gt;I think I read that the eval tag in dashboards has some limitation/changes as compared to eval in search command. See this: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.10/Viz/tokens#Define_token_filtering_and_formatting"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.10/Viz/tokens#Define_token_filtering_and_formatting&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It's NOT listed explicitly that %Z is not supported in dashboard-xml-eval, but seems like it.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:20:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366051#M165309</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-10T16:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why strftime with %Z work differently  between query and eval + token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366052#M165310</link>
      <description>&lt;P&gt;hi and thanks somesoni2&lt;/P&gt;

&lt;P&gt;This doc mentions "different behavior" for strftime. (personally, i see this behavior as a bug)&lt;BR /&gt;
I'm agree with you, but if we have to develop a huge trick just to convert timezone, i found that not user friendly.&lt;/P&gt;

&lt;P&gt;I think i have no other choose that implement a dummy query or other trick to do it.&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Régis&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 16:44:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366052#M165310</guid>
      <dc:creator>ralzate</dc:creator>
      <dc:date>2017-11-10T16:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why strftime with %Z work differently  between query and eval + token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366053#M165311</link>
      <description>&lt;P&gt;@ralzate, I think &lt;CODE&gt;%Z&lt;/CODE&gt;, does not play well with eval based token. So if you have have valid Splunk Entitlement you should create a BUG Request (Tag Bug to this question as well). &lt;/P&gt;

&lt;P&gt;Meanwhile as you have said, &lt;BR /&gt;
1) Use &lt;CODE&gt;%z&lt;/CODE&gt;for Timezone in eval and then convert the same to %Z in your actual search or&lt;BR /&gt;
2) Have a dummy search to over come this situation&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 17:46:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366053#M165311</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-11T17:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why strftime with %Z work differently  between query and eval + token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366054#M165312</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Use %z is not good for me because i need timezone with daylight saving time, in this case i have to search the good correspondence (not easy to do).&lt;/P&gt;

&lt;P&gt;I can do the second solution temporary until i have a better solution.&lt;/P&gt;

&lt;P&gt;I will raise a bug request. &lt;/P&gt;

&lt;P&gt;Thanks all&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 07:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366054#M165312</guid>
      <dc:creator>ralzate</dc:creator>
      <dc:date>2017-11-13T07:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why strftime with %Z work differently  between query and eval + token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366055#M165313</link>
      <description>&lt;P&gt;The only solution that i found was to use "query" part in order to make timezone transformation. &lt;BR /&gt;
I converted data source in epoch time (in the source) and added a new column with local timezone string (like Europe/Paris, EST5EDT,...). The user timezone parameter have to set to UTC.&lt;/P&gt;

&lt;P&gt;And in my query i add the final transformation&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time = _time * 2  - ( strptime(strftime(_time,"%d/%m/%Y %H:%M:%S") . " $token_timezone$","%d/%m/%Y %H:%M:%S %Z"))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If it can help someone else.&lt;/P&gt;

&lt;P&gt;Regards&lt;BR /&gt;
Régis&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 09:05:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-strftime-with-Z-work-differently-between-query-and-eval/m-p/366055#M165313</guid>
      <dc:creator>ralzate</dc:creator>
      <dc:date>2018-03-27T09:05:03Z</dc:date>
    </item>
  </channel>
</rss>

