Splunk Search

Single Value visualisation for a timechart with sparkline and showing the group by field

MCW
Explorer

Hi expert,

My SPL looks something like:

index=<> sourcetype::<>
| <do some usual data manipulation>
| timechart min(free) AS min_free span=1d limit=bottom1  usenull=f BY hostname
| filldown

What I want to achieve is displaying the outcome as Single Value visualisation with sparkline.

My expectation is to have the very last and smallest value min_free for the time span selected displayed and showing the hostname with the smallest min_free shown in the same visual.

However, I get different outcome. The BY split appears to group data by hostname first and then applies the min_free value as secondary sort criteria.

Following is what I get:

MCW_1-1715929393497.png

 

When I modify the SPL timechart to limit=bottom2, I get the following.

MCW_2-1715929571966.png

 

What I want with a slightly modified SPL (limit=bottom1 useother=f) is to only display the circled middle one with the Single Value showing both the latest smallest min_free and hostname values.

How can I achieve this?

Thanks,

MCW

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
``` bucket time by day ```
| bin _time span=1d 
``` find minimum for each host for each day ```
| stats min(free) AS min_free BY _time hostname
``` find lowest for minimum for each day ```
| eventstats min(min_free) as lowest by _time
``` find host which has that minimum for each day ```
| eval min_host=if(min_free=lowest,hostname,null())
``` find the latest host which has the daily minumum ```
| eventstats latest(min_host) as latest_lowest
``` just keep that host ```
| where hostname==latest_lowest
``` switch to "chart" format ```
| xyseries _time hostname min_free

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
``` bucket time by day ```
| bin _time span=1d 
``` find minimum for each host for each day ```
| stats min(free) AS min_free BY _time hostname
``` find lowest for minimum for each day ```
| eventstats min(min_free) as lowest by _time
``` find host which has that minimum for each day ```
| eval min_host=if(min_free=lowest,hostname,null())
``` find the latest host which has the daily minumum ```
| eventstats latest(min_host) as latest_lowest
``` just keep that host ```
| where hostname==latest_lowest
``` switch to "chart" format ```
| xyseries _time hostname min_free
0 Karma

MCW
Explorer

Thanks very much ITWhisper, it does work for what I need. Cheers!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...