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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...