Reporting

How do I make a monthly report which displays a difference in a time range from a certain date until now?

daniel333
Builder

All,

I want to send a monthly report basically saying how many months until a date hits.

some meta code, looking for this

| eval timeinmonthsmonths = "1/1/2020" - now()

thanks
-Daniel

Tags (1)
0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

hi @daniel333,

Did the either of the answers below solve your problem? If so, please resolve this post by approving it!
If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!

0 Karma

samhays
Path Finder

Something like the following may work for you:

<base search>
| eval end_time=strptime("1/1/2020", "%m/%d/%Y")
| eval time_in_days = round((end_time - now()) / 86400, 2)
| table time_in_days

time_in_months can be a little bit harder because of the variable length of days per month.

VatsalJagani
SplunkTrust
SplunkTrust

Hi @daniel333,
Can you try this query?
| makeresults | eval date="2018-12-07" | eval timeinmonthsmonths = ceiling((strptime(date, "%Y-%m-%d") - now())/(3600*24*30.41))
You can remove ceiling command if you want months in floating point.

Hope this helps!!!

0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...