Splunk Search

Change search based on Token Value

moonie
Explorer

Hi,

I am kind of new to Splunk and have a problem with my search. I have a dashboard where I have an input field for a ID. I search two different inputlookups with this ID and my dashboard is based on this.
But not every table entry has the field for this ID, sometimes the field is not existing. I tried to fix this by searching  id!=*, which works fine when I just enter * for ID Inputfield, but in case I want to put an actual ID I don't want to search for all entries with id!=* (not existing). 
Is there a way to change my search based on the Tokenvalue I enter in the input field? So if I enter * the search looks for id=* & id!=*, but if I enter an actual id the search only looks for id=$id$? 

Any help would be highly appreciated! Thanks

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

In the change handler for the input, eval a new token based on (using an if function) whether the input value is * or not and set the value of this token to either "id=*" or "id!=$inputtoken$" and use this new token in your search, that is, the new token includes the field to be matched.

0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...