Splunk Search

how to find differnce between epoch

karunagaraprabh
Explorer

When i try to find the difference between two epoc

1)find the days range i get blank values
2) and i need to filter only records where days =0

| eval printedA_epoch=strptime(printedtimestrampA,"%Y-%m-%dT%H:%M:%S.%Q"),printedB_epoch=strptime(printedtimestrampB,"%Y-%m-%dT%H:%M:%S.%Q")
| eval indextime =_indextime
| eval diffA=indextime-printedA_epoch, diffB=indextime-printedB_epoch
| eval daysA= round((diffA/86400),0) , daysB= round((diffB/86400),0)
| table host,printedA_epoch,printedB_epoch,indextime,diffA,diffB,daysA,daysB

karunagaraprabh_2-1592987307771.png

 

 

 

 

Labels (1)
0 Karma

rnowitzki
Builder

I just saw that you basically assked the question twice. 


https://community.splunk.com/t5/Splunk-Search/How-to-find-the-no-of-days-different-between-indexed-d...


You are on a good way with Giuseppe, so maybe you want to remove this duplicate.

--
Karma and/or Solution tagging appreciated.
0 Karma

rnowitzki
Builder

Hi @karunagaraprabh ,

Looking at your screenshot, it looks like printedA_epoch an printedA_epoch are MV (Multi Value) fields, is that correct?

So something in your SPL (that is not visible in your Screenshot) puts all the timestamps belonging to one host in a MV field. So the calculation does not work. You have to know/define which timestamp you want to calculate against the indextime, or (if you need to calculate against all) you have to change the SPL so that there is a line for each A and B timestamp pair.

We might need the full SPL and/or some sample data to help more detailed.


--
Karma and/or Solution tagging appreciated.
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Catalog Is Now Generally Available on Splunk Cloud Platform

A Unified View of Your Data  Security logs, application events, business data, and historical telemetry often ...

Developer Spotlight with Eduard Lekanne

From Network Engineer to Building Agentic AI for Splunk Eduard Lekanne has been architecting technology ...

From Data Landing to Insight

Search Across More of Your Data Ecosystem The data you need may live in Splunk, high-volume machine data, ...