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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...