Dashboards & Visualizations

strptime with time zone - eval token drilldown

gavalle
New Member

When evaluating this token in an "eval" drilldown:
strptime("2000-01-01 +00:00", "%F %:z")
It does not produce any result.

...But, actually, if in a standard search we write:
eval foo = strptime("2000-01-01 +00:00", "%F %:z")
It will produce "946684800" as result, which is the correct epoch we are looking for.

In the end, it looks like the command is properly written but, for some reasons, it cannot work in drilldowns.
Do you know why?

0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@gavalle,

In the dashboard drilldown, its throws an error due to ":" character between % and z. Remove the colon(:) and try strptime("2000-01-01 +00:00", "%F %z") in the eval and it should work. Somehow search bar ignores this while parsing.

Below works for me

<dashboard>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults|eval time="2000-01-01 +00:00"</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">cell</option>
        <drilldown>
          <eval token="NEW_TIME">strptime("2000-01-01 +00:00","%F %z")</eval>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <html>
      <h1>$NEW_TIME$ </h1>
    </html>
  </row>
</dashboard>
Happy Splunking!

View solution in original post

0 Karma

renjith_nair
SplunkTrust
SplunkTrust

@gavalle,

In the dashboard drilldown, its throws an error due to ":" character between % and z. Remove the colon(:) and try strptime("2000-01-01 +00:00", "%F %z") in the eval and it should work. Somehow search bar ignores this while parsing.

Below works for me

<dashboard>
  <row>
    <panel>
      <table>
        <search>
          <query>|makeresults|eval time="2000-01-01 +00:00"</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">cell</option>
        <drilldown>
          <eval token="NEW_TIME">strptime("2000-01-01 +00:00","%F %z")</eval>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <html>
      <h1>$NEW_TIME$ </h1>
    </html>
  </row>
</dashboard>
Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...