Dashboards & Visualizations

Filtering the events excluding certain word from regex

deepak_93
Engager

I need to filter the event which does not contain word "error".

For example, I have events containing-
"POST /operation/requiredword" 
"POST /operation/requiredword | error".

I want to count only the "POST /operation/requiredword" and exclude the "POST /operation/requiredword | error".

Here is the query I am using right now and it is giving me both the events with and without containing "error":

index="depat-test-app"
| rex "DN: (?<ConsumingApp>.*?)[}\s]"
| rex field=_raw "(?<Passed>(POST \/opertion\/requiredword))
| stats count(passed) by ConsumingApp

 

What I want is something like this:

index="depat-test-app" | rex "DN: (?<ConsumingApp>.*?)[}\s]" | rex field=_raw "(?<Passed>(POST \/operation\/requiredword NOT error )) | stats count(passed) by ConsumingApp
Labels (1)
0 Karma

vnravikumar
Champion

Hi

Try this

| makeresults 
| eval test="\"POST /operation/requiredword\",\"POST /operation/requiredword | error\"" 
| makemv delim="," test 
| mvexpand test 
| regex test!="(\| error)"
0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...