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 Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...