Splunk Search

Subtract Dates/Time

schufi01
Path Finder

Hi,

can somebody explain, why I dont get any results?

index=... 
| eval Timestamp=strftime(_time,"%d-%m-%Y %H:%M:%S")
| eval CurrentTime=strftime(now(),"%d-%m-%Y %H:%M:%S")
| eval NotUsedFor=(CurrentTime-Timestamp)
| chart max(NotUsedFor) by host

I want a chart that shows the difference of the CurrentTime and the Timestamp

 

Labels (2)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @schufi01,

You must make calculation before formatting the timestamps;

index=... 
| eval NotUsedFor=(now()-_time)
| chart max(NotUsedFor) by host
If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

scelikok
SplunkTrust
SplunkTrust

Hi @schufi01,

You must make calculation before formatting the timestamps;

index=... 
| eval NotUsedFor=(now()-_time)
| chart max(NotUsedFor) by host
If this reply helps you an upvote and "Accept as Solution" is appreciated.
Get Updates on the Splunk Community!

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...