Splunk Search

How do I write a search to filter out certain values for a field?

asarran
Path Finder

Hey Fellow Splunkers

I have an issue when searching for similar events that are only unique by one character.

Example: (L= lbs G=Grams)

Vegetables=5.1Lbs
Vegetables=2.1Gbs

Giving this example, If I search for Vegetable="*", it will populate both:

Vegetables=5.1Lbs
Vegetables=2.1Gbs

How can I search Vegetables="" and have it only populate:

Vegetables=2.1Gbs
Vegetables=9.2Gbs
Vegetables=4.3Gbs
Vegetables=3.5Gbs
Vegetables=2.8Gbs

Basically, i would like the emphasis of the search solely specifically with Vegetables, but only populate the events with "Gbs", not "Lbs"?

0 Karma

sundareshr
Legend

If you want to only return Gbs, try vegetables="*Gbs" OR NOT vegetable="*Lbs" (to catch everything except Lbs)

asarran
Path Finder

Thank You, i didn't realize how simple that was lol. I'm sorry.

0 Karma

sundareshr
Legend

Happens to all of us 🙂 If this worked for you, please accept the answer to close it out.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...