Splunk Search

How to exclude "DRAFT" in my regex query

splunkman341
Communicator

Hi guys,

I need to exclude returning the words "DRAFT" from the current query that I have, but I am not sure on where exactly to put it. Here is the query :

index=doccloud_main sourcetype=doccloud_catalina "Document workspace"| rex "Category:\s*(?<Category>[^,]*),\s*subCategory:\s*(?<subCategory>.*)" | stats count by Category, subCategory | sort 30 - count

Can someone please help?

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Try this:

index=doccloud_main sourcetype=doccloud_catalina "Document workspace" NOT "draft" | rex "Category:\s*(?<Category>[^,]*),\s*subCategory:\s*(?<subCategory>.*)" | stats count by Category, subCategory | sort 30 - count

View solution in original post

woodcock
Esteemed Legend

Try this:

index=doccloud_main sourcetype=doccloud_catalina "Document workspace" NOT "draft" | rex "Category:\s*(?<Category>[^,]*),\s*subCategory:\s*(?<subCategory>.*)" | stats count by Category, subCategory | sort 30 - count

rsennett_splunk
Splunk Employee
Splunk Employee

Please edit your question and include a sample of events. (that contain the word DRAFT.)
Also... do you want to exclude the event if it has the word DRAFT or do you want to not include data that has a category or sub category of DRAFT? give us some context...

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...