Dashboards & Visualizations

How to graph by other fields after a top 10?

lavaca
New Member

The fields I am interested in are: action (100+ values), customer (6 values), timeTaken (~continuous)

I would like to plot a bunch of graphs, but only from entries of the 10 most common actions across all customers.

For example, a column chart with each of these 10 actions along the x-axis, the 95th percentile of timeTaken on y, with stacking columns for each customer. So far I have tried:

top 10 action | chart perc95(timeTaken) by action, customer

This returns no results found, so I tried to create my own top 10 using sort and head:

stats count by action | sort -count | head 10 | chart perc96(timeTaken) by action,customer

I get what I expect after head 10, but then cannot plot the graph I need after that - it returns no results found.

Help would be very much appreciated! Thank you.

Tags (3)
0 Karma
1 Solution

somesoni2
Revered Legend

Both top and stats in your command are removing the field timeTaken, hence when you try to chart using unavailable field timeTaken, it returns no rows.
Try something like this (the subsearch gets the top 10 action for each customer, add that as filter, so that your chart will show data for those only)

your base search  [ your base search | stats count by action, customer | sort customer -count | streamstats  count as sno by customer | where sno<=10 | table customer action | format]  | chart perc96(timeTaken) by action,customer

View solution in original post

somesoni2
Revered Legend

Both top and stats in your command are removing the field timeTaken, hence when you try to chart using unavailable field timeTaken, it returns no rows.
Try something like this (the subsearch gets the top 10 action for each customer, add that as filter, so that your chart will show data for those only)

your base search  [ your base search | stats count by action, customer | sort customer -count | streamstats  count as sno by customer | where sno<=10 | table customer action | format]  | chart perc96(timeTaken) by action,customer

lavaca
New Member

Thank you, a subsearch did the trick!

0 Karma

bmacias84
Champion

You can use the map command.

... | top 10 customer | map search="search ... customer=$customer$ | chart perc95(timeTaken) by action, customer "
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

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