Splunk Search

Finding Status in Transaction

Mubarish
Path Finder

Hi
I have a set of logs over which the transaction command is applied for SessionID and some fields are extracted .Below is the sample result.

FileName StatusCode
814xxx
Setxxxx.csv
0
0
0
814xxx
xxx.ZIP.asc
0
xxx.ZIP.asc
91
xxx.ZIP.asc
1481
0
814xxx
0

The Status will be FAILURE if any of the StatusCode value for a particular SessionID have non Zero value otherwise Status will be COMPLETED

The expected output is

FileName StatusCode StatusCode
814xxx
Setxxxx.csv
0
COMPLETED
0
0
814xxx
xxx.ZIP.asc
0
FAILURE
xxx.ZIP.asc
91
xxx.ZIP.asc
1481
0
814xxx
0 COMPLETED

How can i do this?

Tags (2)
0 Karma

somesoni2
Revered Legend

You can try any of these

Your base search | eval StatusCode=if(StatusCode=0,"COMPLETED","FAILURE") | your transaction command | eval StatusCode=if(mvcount(StatusCode)=2,"FAILURE",StatusCode)


Your search with transaction command | eventstats sum(StatusCode) as AggrStatusCode by SessionID | eval StatusCode=if(AggrStatusCode=0,"COMPLETED","FAILURE")

jimodonald
Contributor

Could you sum the StatusCode and use an IF statement to identify the FAILURE/COMPLETED ?

i.e.

 ...  | stats sum(StatusCode) by SessionID | eval StatusCode=if(StatusCode==0,"COMPLETED","FAILURE") ...

strive
Influencer

Pipe the transaction results and use the eval command

0 Karma
Get Updates on the Splunk Community!

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...