Splunk Search

How to calculate dates in splunk?

ositaumeozulu
Explorer

again i wanted to list difference in dates between two periods and i have this code

| eval LPD = strptime(LastPickupDate, "%m-%d-%Y %H:%M:%S")
| eval IInT = strptime(IIT, "%m-%d-%Y %H:%M:%S")
| eval diff = (IInT-LPD)/86400

| stats list(diff) by FacilityName

still getting blanks 

Labels (1)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @ositaumeozulu,

let me understand: in each event you have LastPickupDate and IIT in those formats and FacilityName, is this correct?

Check if you have all the three fields in each event and check the date formats.

Ciao.

Giuseppe

 

0 Karma

ositaumeozulu
Explorer

Hi @gcusello 

Many thanks, has gotten the hang of it, for the format i was using - instead of / as in my format, thanks for all your helps, the whole codes are working now

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @ositaumeozulu,

good for you, see next time!

Please accept one answer for the other people of Community

Ciao and happy splunking

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma

ositaumeozulu
Explorer

Hi @gcusello 

please let me upload the screenshot of the formats you asked for

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...