Splunk Search

stacked column chart of success/failures split by URL over time

jon
New Member

I'd like to have a stacked column chart showing the number of successful and failed requests to URLs over time. Following the instructions at http://docs.splunk.com/Documentation/Splunk/latest/User/ReportOfMultipleDataSeries I can show success and failure separately, but ideally it would show 1 stacked column per URL split by success/failure. Is this possible?

The search I have so far is -

index="online"
| bucket _time span=1h 
| stats count(eval(code="200")) as succ, count(eval(code!="200")) as fail by url, _time 
| eval s1="success failure" 
| makemv s1 
| mvexpand s1 
| eval yval=case(s1=="success",succ,s1=="failure",fail)  
| eval series=s1+":"+url 
| xyseries _time,series,yval 
Tags (1)
0 Karma
1 Solution

sideview
SplunkTrust
SplunkTrust

xyseries is an advanced command that allows you to turn rows following the output pattern of stats into rows that follow the output pattern of chart. However if you want chartable rows it's easier to just use chart directly. And as for the eval and makemv and mvexpand commands, I think you can do the same thing just with one eval clause.

Try this:

index=online | eval type=if(code=="200","success","fail") | chart count over url by type

and then of course set the chart type to 'bar' if you want the URL's to be printed on the yaxis and the bars to stretch horizontally, and to 'column' if you want the URL's across the x-axis.

View solution in original post

sideview
SplunkTrust
SplunkTrust

xyseries is an advanced command that allows you to turn rows following the output pattern of stats into rows that follow the output pattern of chart. However if you want chartable rows it's easier to just use chart directly. And as for the eval and makemv and mvexpand commands, I think you can do the same thing just with one eval clause.

Try this:

index=online | eval type=if(code=="200","success","fail") | chart count over url by type

and then of course set the chart type to 'bar' if you want the URL's to be printed on the yaxis and the bars to stretch horizontally, and to 'column' if you want the URL's across the x-axis.

markrobinson734
Explorer

Is there anyway to specify colors?

0 Karma

sideview
SplunkTrust
SplunkTrust

I see. I missed that. So you want time on the x-axis, then one non-stacked bar per URL, and each of those bars you want those split by success and failure? You can of course concatenate the url and type field, split by that concatenated field, and then stack the overall chart, but that would shuffle all the URL's together and be really messy. I don't know of a way to both split on two dimensions while stacking one and not stacking the other.

0 Karma

hjwang
Contributor

But in this way, the _time series can not to be presented on the x-axis. if it is required to put time bucket on x-axis , then in each bucket , break down several url and the y-axis remains this type, any way to do this? Thanks!!

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