Splunk Search

Parse time in drilldown and snap to beginning of that month

splunkmasterfle
Path Finder

I am creating a series of dashboards with will enable to globally view data and drilldown to specific events.

My first dashboard is the percentage of uptime of all my services in Nagios. My search is as follows:

index=nagios-availability
| timechart span=1mon limit=100 eval(round(avg(uptimepercentage),3)) by servicename
| eval Time=strftime(_time,"%B %Y")
| table Time,*
| fields - _time

I am modifying the _time because I want to see the MONTH and YEAR (like MARCH 2014) in order for it to be more user friendly. I have created a drilldown from this dashboard to another form to allow users to click in a specific cell and have uptime information regarding that month (by day) appear in another dashboard.

<drilldown>
<link>
/app/SplunkForNagios/service-availability-month? form.theservicename=$click.name2$&form.monthYear=$click.value$
</link>
</drilldown>

This is the search in my second dashboard which I would like to show the average availability by day in that specific month. Here is the search I have so far:

index="nagios-availability" servicename="$theservicename$" | timechart span=1day limit=100 eval(round(avg(uptimepercentage),3)) by servicename

The problem is that I don't know how to tell this search to snap to the beginning of the month and year that I am passing as a parameter. I have tried a couple things with no luck.

Any ideas ??

Thanks

1 Solution

somesoni2
Revered Legend

Try this a your second search.

index="nagios-availability" servicename="$theservicename$"  
[|stats count | eval earliest=strptime("01 "."$monthYear$","%d %B %Y") | eval latest=relative_time(earliest,"+1mon@mon") | table earliest latest | format "" "" "" "" "" ""]
| timechart span=1day limit=100 eval(round(avg(uptimepercentage),3)) by servicename

View solution in original post

somesoni2
Revered Legend

Try this a your second search.

index="nagios-availability" servicename="$theservicename$"  
[|stats count | eval earliest=strptime("01 "."$monthYear$","%d %B %Y") | eval latest=relative_time(earliest,"+1mon@mon") | table earliest latest | format "" "" "" "" "" ""]
| timechart span=1day limit=100 eval(round(avg(uptimepercentage),3)) by servicename

splunkmasterfle
Path Finder

This did in fact work. Thank You

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...