Dashboards & Visualizations

Not able to draw bar chart

uppukumar
Explorer

Hi All,

<|script python afiStatistics afiStats >
Above query Result is following output:

Type Count
Allowed 11
Blocked 12

With the above query i want create Bar chart, But it is not able to draw the chart

Expected output
|
Type|--------------------------------------------
|--------------------------
|
Count

advance Thanks,

0 Karma

woodcock
Esteemed Legend

Just add | table Type Count to change the order of the fields; here is a run-anywhere example:

| makeresults 
| eval raw="Type=Allowed,Count=11 Type=Blocked,Count=12" 
| makemv raw 
| mvexpand raw 
| rename raw As _raw 
| kv
| fields - _*
| table Type Count
0 Karma

rbechtold
Communicator

Hey Uppukumar!

Let me know if this works for you:

...BASE SEARCH...
| table Type Count 
| chart values(Count) AS Count by Type 
| sort - Count

Make sure the "Bar Chart" is selected as your visualization type, and your data should display the way you described.

Since the count is already aggregated in your data, the values function should work for you.

If you would prefer aggregate your data or chart it in a different way, refer to the "Stats function options" section of the Splunk chart documentation.

https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/Chart

Let me know if you have any problems!

0 Karma
Get Updates on the Splunk Community!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...