Splunk Search

Trouble with UTC time

BearMormont
Path Finder

I have some search results that return values in the format %Y-%m-%d %H:%M:%S. For example:

...some search... | table UpdateTime

This would yield the following table:

UpdateTime

2018-06-06 13:49:28
2017-12-22 08:23:21

I know for a fact that time string is in UTC, not my local time. All I need to do is display the number of minutes that have elapsed between that UTC string and the time the event was recorded (_time). Everything I try keeps giving me negative numbers for recent events, I assume because it is treating the UpdateTime field as being in local time, not UTC.

Can anyone help me?

Tags (2)
0 Karma
1 Solution

BearMormont
Path Finder

Figured it out. Update Time needed a timezone identifier:

eval UpdateTime = UpdateTime." UTC"

Then I can convert the value properly:

eval EpochTime = strptime(UpdateTime, "%Y-%m-%d %H:%M:%S %Z")
eval ElapsedMinutes = (_time - UpdateTime) / 60

View solution in original post

0 Karma

BearMormont
Path Finder

Figured it out. Update Time needed a timezone identifier:

eval UpdateTime = UpdateTime." UTC"

Then I can convert the value properly:

eval EpochTime = strptime(UpdateTime, "%Y-%m-%d %H:%M:%S %Z")
eval ElapsedMinutes = (_time - UpdateTime) / 60
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 ...