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!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

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