Splunk Search

How do you write a search for an incremental count for a field evaluating success vs. failure?

karthikeyan_k14
New Member

My output is

Success
Success
Success
Failure
Failure
Faliure
Success
Success
Success
Failure
Success
Success
Success
Success
Success
Success

I need count should be

Field1 count
Success 1
Success 1
Success 1
Failure 0
Failure 0
Faliure 0
Success 2
Success 2
Success 2
Failure 0
Success 3
Success 3
Success 3
Success 3
Success 3
Success 3
...
...
...
..

Success 15
Success 15
Failure 0
Success 16
Success 16
....... like wise

currently my query is .............streamstats count(eval (Field1="Success")) as count by Field1 rest_on_change=true | table Field count

0 Karma

DalJeanis
Legend

Here's what I generally do for that, assuming the Success or Failure field is called Field1.

| streamstats current=f last(Field1) as priorField1
| eval newgroup=case(Field1="Failure",null(),   isnull(priorField1),1,   priorField1!=Field1,1)
| streamstats sum(newgroup) as groupno by Field1
| Table Field1 groupno
0 Karma
Get Updates on the Splunk Community!

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...