Splunk Search

Issue with strftime time function. It always adds few minutes to actual results

abochare
New Member

Hi Team,
I have gone through the forum but couldnt find which suits my requirement.
We are trying to calculate time differences, for which I am using strftime. but if i am using strftime it always adds few minutes to expected results. Can anyone please explain what is wrong with it? Attaching 2 screenshots for reference

alt text
alt text

0 Karma

to4kawa
Ultra Champion

cf. https://en.wikipedia.org/wiki/Unix_time

UNIX time starts at 00:00:00 on January 1, 1970 as "1".
strftime(hoo,"%M")
If hoo is a small number, it must be a value between 00 and 59 .it is a letter.

round() /60
Since this is divided by 60, it will inevitably take smaller numbers.

The result is different because the operation being performed is different.

0 Karma

to4kawa
Ultra Champion

Is there any reason not to paste the query as text?

0 Karma

vnravikumar
Champion

Hi

check with

...your query..| eval diff = tostring((tNow - maxLastTime), "duration") 
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 ...