Dashboards & Visualizations

Add/Subtract from timestamp entered in a form.

itghelp
Path Finder

I have a form that takes 2 timestamps in UTC. I need to convert them to local time and then add or subtract an hour. So far I've tried:

host="juniper" port="$port$" src_translated_ip="$ip$"
timeformat="%Y-%m-%dT%H:%M:%S.%3N%"
earliest="$first$"
latest="$last$"

This correctly converts the UTC to local time, but I can't figure out how to add or subtract an hour to "$first$" and "$last$" before passing them to earliest and also making sure they get converted.

This was my attempt, but the timestamps are way off:

host="juniper" port="$port$" src_translated_ip="$ip$" timeformat="%Y-%m-%dT%H:%M:%S.%3N%Z" |
eval earliest=relative_time("$first$", "-1h") |
eval latest=relative_time("$last$", "+1h")

Tags (1)
0 Karma
1 Solution

itghelp
Path Finder

Turns out it wasn't so complicated:

ost="juniper" port="$port$" src_translated_ip="$ip$" timeformat="%Y-%m-%dT%H:%M:%S.%3N%Z" earliest="$first$-2h" latest="$last$+2h"

View solution in original post

0 Karma

itghelp
Path Finder

Turns out it wasn't so complicated:

ost="juniper" port="$port$" src_translated_ip="$ip$" timeformat="%Y-%m-%dT%H:%M:%S.%3N%Z" earliest="$first$-2h" latest="$last$+2h"

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 ...