Splunk Search

How to suppress a search with multiple matches by using lookups?

rmukalla
Loves-to-Learn Everything

I am trying to minimize or simplify the below search, which has many match filters on further control.

Any suggestions or recommendations to handle with lookups rather hard coding in the search itself?

index=myindex "PROBLEM"
| rex field=_raw "(?<alert_service>^.+?)"
| eval alert_suppress = case (
(match(alert_service, "^Swarm_.*")),"1",
(match(alert_service, "^HTTPS\s+Certificate\s+Status$") AND match (alert_info, "expire|expired|expires")),"1",
(match(alert_service, "^(Disk|Disk_inode|Memory|Load)$")), "1",
(match(alert_service, "^Qualys\s+Service\s+Test$") AND match (alert_host, "^(papi|pbo|pfo|pip|ppb|pps|prep|ptp)")),"1",
(match(alert_service, "ceph-mon") AND match (alert_host, "^masifdat[0-9][0-9]")),"1",
(match(alert_service, "puppet") AND match (alert_host, "(((dbmgmt|dbrac|qkafka|qzkpr|qkafkamgmt|(dbrac-scan)|fproxy|pproxy)\d+)|(dbrac-scan))\.")),"1",
(match(alert_service, "crond") AND match (alert_host, "(fproxy|pproxy)[0-9]{2}\.")),"1",
match(alert_host, "^(acwin|netmon|vma)"), "1",
match(alert_info, "Service check timed out after"), "1", 1 = 1, "0" )

 

Labels (1)
Tags (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Whenever using that type of multiple case/match statement, always order them from most frequent to least frequent occurrence, from a performance point of view.

You could use a lookup to solve the single match on alert_service with wildcard support in the lookup, but the wildcarding would only support basic wildcards, as opposed to regex that you are using.

For the multiple field matches, you'd might be able to get away with simple wildcarding alert_info and alert_host where those fields are not relevant, but it will ultimately come down to whether you get too many false positives/negatives depending on your data.

Setting a default value for the lookup of alert_supress = 0, would then indicate no match

 

0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...