Splunk Search

eval statement not giving expected result

hrishi_deshpand
Explorer

index = pcf_logs cf_org_name = creorg OR cf_org_name = SvcITDnFAppsOrg cf_app_name=VerifyReviewConsumerService host="*" | eval message = case(like(msg,"%Auto Approved%"), "Auto Approved", like(msg,"%Auto Rejected%"), "Auto Rejected",1=1,msg)|stats sum(Count) as Count by message | table message Count

 

I am having msg in event which contains Auto Approve or  Auto Rejected in between a big sentence

I want to count auto approve and auto rejected events but it doesn't give the expected result.

 

 

Labels (3)
0 Karma

hrishi_deshpand
Explorer

index = pcf_logs cf_org_name = creorg OR cf_org_name = SvcITDnFAppsOrg cf_app_name=VerifyReviewConsumerService host="*" | eval msg = case(like(msg,"%Auto Approved%"), "Auto Approved", like(msg,"%Auto Rejected%"), "Auto Rejected", like(msg,"%manual review%"),"Manual Review")|stats count by msg | table msg, count

 

this worked perfectly just incase any one interested thanks

0 Karma

hrishi_deshpand
Explorer

index = pcf_logs cf_org_name = creorg OR cf_org_name = SvcITDnFAppsOrg cf_app_name=VerifyReviewConsumerService host="*" | eval msg = case(like(msg,"%Auto Approved%"), "Auto Approved", like(msg,"%Auto Rejected%"), "Auto Rejected")|stats count by msg | table count, msg

 

 

able to get the grouping but visualization for pie chart says need numeric data

0 Karma

s2_splunk
Splunk Employee
Splunk Employee

You don't need the table command at the end for the visualization; remove it and it should work. 

0 Karma

s2_splunk
Splunk Employee
Splunk Employee

Can you provide an anonymized sample event?

Also, what IS the unexpected result you are getting?

0 Karma
Get Updates on the Splunk Community!

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...