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

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...