Splunk Search

Will using a wildcard with where work?

brcox9090
New Member

I am trying to get a wildcard to work with a where clause. Not sure if I'm doing something wrong altogether or just missing some syntax but my search is as follows:

 

index=my_index | where description=" Changed * role to * Admin"

 

basically looking up whether any user had their role changed to any admin role. Thought this would be an easy one, and it is not.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The where command does not support wildcards.  As @gcusello says, use the search command or, best, put the text in the base search.

To use wildcards in where, we need to use either the match or like function.

| where match(_raw, " Changed .* role to .* Admin")

| where like(_raw, " Changed % role to % Admin")

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @brcox9090,

why do you want to use where?

is there something between the main search and the where command?

if yes, Anyway, use the search command, instead where.

otherwise, you can put all in the main search so you'll have a more performant search.

index=my_index description=" Changed * role to * Admin"

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...