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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...