This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the same dataset that you will have already downloaded and ingested into Splunk. If not, please go to the Tutorial and complete it (or at least download and ingest the dataset).
This is the sixth blog in the series, and builds on the dashboard created in the previous blogs.
With the zoom.earliest and zoom.latest tokens set to non-null values, we want to display a zoomed-in chart panel, similar to the chart that was displayed when there was no selection handler present, only in a new panel. However, this panel's search, while similar to the timeframe selection panel, uses 5-minute buckets instead of hourly buckets, and the failures are counted rather than being rates.
Note that a consequence of the change in bucket size may be that there is a different number of time buckets with SLO breaches when measured at this scale than when measured at the larger scale. This is quite normal, but you should be aware that this apparent discrepancy may arise.
sourcetype=access_combined_wcookie earliest=$zoom.earliest$ latest=$zoom.latest$
| timechart span=5m count by status
| addtotals row=t fieldname=_total
| eval 200=round(100*'200'/_total,2)
| eval threshold=85
| eventstats count(eval('200'<85)) as _breaches count as _total
| eval _failure_rate=round(100*_breaches/_total,2)
| eval _panel_colour=case(_failure_rate < 15, "#00ff00", _failure_rate < 20, "#80ff00", _failure_rate < 25, "#ffff00", _failure_rate < 30, "#ff8000", true(), "#ff0000")
| eval _text_colour=case(_failure_rate < 15, "black", _failure_rate < 20, "black", _failure_rate < 25, "black", _failure_rate < 30, "white", true(), "white")
The search overrides the earliest and latest values given by the panel's time range, using the earliest and latest values set by the zoom selection.
<row depends="$zoom.earliest$,$zoom.latest$">
Note that listing more than one token in the depends attribute, means all (both) must be non-null for the row to show.
<panel id="request_status_zoom">
<html depends="$alwaysHide$">
<style>
#request_status_zoom .dashboard-panel
{
background-color: $zoom_panel_colour$ !important;
text-align: center;
}
#request_status_zoom h2.panel-title
{
color: $zoom_text_colour$ !important;
}
</style>
</html>
This screen image shows the zoom panel HTML style.
<done>
<set token="zoom_failure_rate">$result._failure_rate$</set>
<set token="zoom_panel_colour">$result._panel_colour$</set>
<set token="zoom_text_colour">$result._text_colour$</set>
</done>
This screen image shows the done handler setting the timeframe tokens.
You will see that when the timeframe is selected, the new panel appears. To remove it, simply click on Reset Zoom.
Next step is to go on to part 7 where you will add another new panel which will drill-down to the events behind the charts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.