Splunk Search

Help joining the 2 below searches

tomjb94
Observer

Hi - 

We have a requirement to join the below eval statement searches, would it be possible if someone could assist with the solution please?

eval search 1 = index="wpg" host=*pz-pay* OrderSummary | stats count AS "Total"
eval search 2 = index="wpg" host=*pz-pay* OrderSummary AND "Address is invalid, it might contain a card number") | stats count AS "Failure"
eval result =( search 1/search 2)*100

Thanks,

Tom

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try this

(index="wpg" host=*pz-pay*) (OrderSummary OR (OrderSummary AND "Address is invalid, it might contain a card number"))
| eval is_invalid=if(searchmatch("Address is invalid, it might contain a card number"), 1, 0)
| stats count AS "Total", count(eval(is_invalid=1)) as Failure
| eval result = (Failure * 100)/Total
---
If this reply helps you, Karma would be appreciated.
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something llke this

index="wpg" host=*pz-pay* OrderSummary
| eventstats count AS "Total"
| search "Address is invalid, it might contain a card number"
| stats count AS "Failure" values(Total) as Total
| eval result = (Total/Failure)*100
0 Karma
Get Updates on the Splunk Community!

See Splunk Platform & Observability Innovations at Cisco Live EMEA

Hi Splunkers, Learn about what’s next for Splunk Platform at Cisco Live EMEA.  Data silos are a big challenge ...

The OpenTelemetry Certified Associate (OTCA) Exam

What’s this OTCA exam? The Linux Foundation offers the OpenTelemetry Certified Associate (OTCA) credential to ...

From Manual to Agentic: Level Up Your SOC at Cisco Live

Welcome to the Era of the Agentic SOC   Are you tired of being a manual alert responder? The security ...