Archive

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

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

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

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

Is there anyway to specify colors?

0 Karma

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

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