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 Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...