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 Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...