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!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...