Dashboards & Visualizations

how to make a new field based on status code

Mohsin123
Path Finder

I've this | eval status=if(CODE=200,"success","failure") 

i need to have 3 fields like success, failure , total

I'm trying this 

| stats eval(if(c(CODE=200))) as success

but its not working 

Could you please help ?

Labels (1)
0 Karma
1 Solution

SanjayReddy
SplunkTrust
SplunkTrust

Hi @Mohsin123 

Can you try this

| stats count(eval(CODE="200")) as "success" count(eval(CODE="<addcodenumber>")) as "failure"  count(CODE) as "total" 


View solution in original post

0 Karma

SanjayReddy
SplunkTrust
SplunkTrust

Hi @Mohsin123 

Can you try this

| stats count(eval(CODE="200")) as "success" count(eval(CODE="<addcodenumber>")) as "failure"  count(CODE) as "total" 


0 Karma
Get Updates on the Splunk Community!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...