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
SplunkTrust
SplunkTrust

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
SplunkTrust
SplunkTrust

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
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...