Dashboards & Visualizations

How do I use a different aggregator based on a token?

sillingworth
Path Finder

I have this search:

... 
| rename value as "Response Time"
| timechart span=1m max("Response Time") by app_name limit=5 useother=false usenull=false

and I'd like to allow 'max("Response Time")' to change to 'avg("Response Time")' depending on user input. Is there a way to do this?

I've tried $token$("Response Time") but that doesn't work.

Tags (2)
0 Karma
1 Solution

sillingworth
Path Finder

Here's how I've done it:

        ...
        | stats max(value) as PerMinMax, avg(value) as PerMinAvg by _time, app_name
        | eval "Response Time"=case("Average"=="Max", PerMinMax, "Average"=="Average", PerMinAvg) 
        | timechart span=1m max("Response Time") by app_name limit=5 useother=false usenull=false

View solution in original post

0 Karma

sillingworth
Path Finder

Here's how I've done it:

        ...
        | stats max(value) as PerMinMax, avg(value) as PerMinAvg by _time, app_name
        | eval "Response Time"=case("Average"=="Max", PerMinMax, "Average"=="Average", PerMinAvg) 
        | timechart span=1m max("Response Time") by app_name limit=5 useother=false usenull=false
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

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