Splunk Search

Group by responseCode

tamnor
Explorer

Hi I have the following query that creates a report of the major transactions for a website with their count and average response time. I would like to seperate the count column into number requests that succeeded and requests that failed for each request type, i.e so divide this count column into requests with response code 200 and requests with response code of anything other than 200.

index=vero_anzn_prod approveRiskRequest OR finalizeQuote OR premiumGrid OR approveRiskAccept OR illustration OR archiveRisks OR premiumInstallments OR add OR recalculateRates OR cancelPolicy OR completeScenario OR search OR save OR getPDF NOT (uri=.js OR uri=.png OR uri=.css OR uri=.gif OR uri=.ico OR uri=.jpg)
| rex field=uri_path mode=sed "s/quote\/[0-9]+/quote\/QUOTENO/"
.
.
.
| rex field=uri_path mode=sed "s/referralHistory\/.*\//referralHistory\/REFHSEARCH\//"
| eval Request=uri_path.method
| stats count avg(responseTime) BY Request

I realize I could add responseCode to the BY part of the query but this doesn't give me exactly what I want.

Thanks.

Tam.

Tags (1)
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

replace your stats command with:

... | eval type=if(responseCode=="200","good","bad") | stats count avg(responeTime) by Request,type
0 Karma
Get Updates on the Splunk Community!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...