Getting Data In

How to use the where clause and wildcard to filter results?

shiftey
Path Finder

Hi,

I am trying to run this search without success (the search runs however there are 0 results)

sourcetype=dhcplogs description=assign | replace ABC* with ABC in dest  | where dest!=ABC

Computers have hostnames in the format "ABC12345678". dest is the field that contains the hostname. I want to exclude these hosts (and other hosts) from the search results.

Any suggestions?

Cheers

Tags (3)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi shiftey,

try something like this:

sourcetype=dhcplogs description=assign | replace ABC* with ABC in dest | where dest!="ABC"

The reason for this is, that where compares the value of two fields or does evaluate boolean expressions. Whereas search can do a wildcard filter like search foo!=bo*.

Hope this helps ...

cheers, MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

Hi shiftey,

try something like this:

sourcetype=dhcplogs description=assign | replace ABC* with ABC in dest | where dest!="ABC"

The reason for this is, that where compares the value of two fields or does evaluate boolean expressions. Whereas search can do a wildcard filter like search foo!=bo*.

Hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...