Splunk Search

count errors with one condition

indeed_2000
Motivator

Hi
need to find error codes then due to ID, count number of IPS.

2021-12-26 22:38:59,248 INFO CUS.AbCD-Server-2-0000000 [LoginService] load idss[IPS=987654*1234-1,productCode=000]
2021-12-26 22:38:59,280 ERROR CUS.AbCD-Server-2-0000000 [LoginService] authorize: [AB_100] This is huge value. ConfigApp[DAILY_STATIC_SECOND_PIN]

2021-12-26 22:38:59,248 INFO CUS.AbCD-Server-2-0000000 [LoginService] load idss[IPS=987654*1234-1,productCode=000]
2021-12-26 22:38:59,280 ERROR CUS.AbCD-Server-2-0000000 [LoginService] authorize: [AB_100] This is huge value. ConfigApp[DAILY_STATIC_SECOND_PIN]

2021-12-26 22:38:59,248 INFO CUS.AbCD-Server-3-9999999 [LoginService] load idss[IPS=123456*4321-1,productCode=000]
2021-12-26 22:38:59,280 ERROR CUS.AbCD-Server-3-9999999 [LoginService] authorize: [AB_500] This is huge value. ConfigApp[DAILY_STATIC_SECOND_PIN]


expected output:
ID                                                                       IPS                                     count
CUS.AbCD-Server-2-0000000   987654*1234-1     2
CUS.AbCD-Server-2-9999999   123456*4321-1     1

 

Any idea?

Thanks,

Labels (5)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults
| eval _raw="2021-12-26 22:38:59,248 INFO CUS.AbCD-Server-2-0000000 [LoginService] load idss[IPS=987654*1234-1,productCode=000]
2021-12-26 22:38:59,280 ERROR CUS.AbCD-Server-2-0000000 [LoginService] authorize: [AB_100] This is huge value. ConfigApp[DAILY_STATIC_SECOND_PIN]
2021-12-26 22:38:59,248 INFO CUS.AbCD-Server-2-0000000 [LoginService] load idss[IPS=987654*1234-1,productCode=000]
2021-12-26 22:38:59,280 ERROR CUS.AbCD-Server-2-0000000 [LoginService] authorize: [AB_100] This is huge value. ConfigApp[DAILY_STATIC_SECOND_PIN]
2021-12-26 22:38:59,248 INFO CUS.AbCD-Server-3-9999999 [LoginService] load idss[IPS=123456*4321-1,productCode=000]
2021-12-26 22:38:59,280 ERROR CUS.AbCD-Server-3-9999999 [LoginService] authorize: [AB_500] This is huge value. ConfigApp[DAILY_STATIC_SECOND_PIN]"
| multikv noheader=t
| table _raw



| rex "\S+\s+\S+\s+INFO\s+(?<ID>\S+).*idss\[IPS=(?<IPS>[^,]+)"
| rex "\S+\s+\S+\s+(?<status>ERROR)\s+(?<ID>\S+)"
| stats values(IPS) as IPS list(status) as status by ID
| stats count by ID IPS status
0 Karma
Get Updates on the Splunk Community!

New Year. New Skills. New Course Releases from Splunk Education

A new year often inspires reflection—and reinvention. Whether your goals include strengthening your security ...

Splunk and TLS: It doesn't have to be too hard

Overview Creating a TLS cert for Splunk usage is pretty much standard openssl.  To make life better, use an ...

Faster Insights with AI, Streamlined Cloud-Native Operations, and More New Lantern ...

Splunk Lantern is a Splunk customer success center that provides practical guidance from Splunk experts on key ...