Splunk Search

count after group http_status and table with client_ip, counts

lim2
Communicator

Want to label sc_status <= 304 as Ok and sc_status >= 400 as Error and get the Ok and Error counts and table the client_ip, count(Ok) , count(Error). I did something like:
index=web sourcetype=iis |if (sc_status<=304, "Ok", "Error")|stats count(Ok) as Pages, count(Error) as Error by client_ip
and
index=web sourcetype=iis |stats count(sc_status <= 302) as Pages, count(sc_status >= 400) as Error by client_ip but the counts are both 0 even though I see the sc_status of 200, 302 and 400, 403. Could someone advise? Thanks.

Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

HI
try something like this:

index=web sourcetype=iis 
| stats count(eval(if(sc_status <= 304, "OK", NULL))) AS OK count(eval(if(sc_status >= 400, "Error", NULL))) AS Error by client_ip

Bye.
Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

HI
try something like this:

index=web sourcetype=iis 
| stats count(eval(if(sc_status <= 304, "OK", NULL))) AS OK count(eval(if(sc_status >= 400, "Error", NULL))) AS Error by client_ip

Bye.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...