Splunk Search

Using Eval to Filter Values

jason_hotchkiss
Communicator

Hello Splunkers - 

I am trying to filter any value that is wrapped in $, such as $host$or $value$.  I thought the below would work, but it is not.  Can someone point out what I am doing wrong?  Thanks!

| eval dollar_sign=if(host_value=="$host$" OR host_value=="$value$", "yes", "no")
| search NOT dollar_sign=yes


Labels (1)
0 Karma
1 Solution

johnhuang
Motivator
| eval dollar_sign=IF(LIKE(host_value, "$%$"), "yes", "no")

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If you are using this in a dashboard, the dollar signs have to be doubled up otherwise it is looking for tokens

| eval dollar_sign=if(host_value=="$$host$$" OR host_value=="$$value$$", "yes", "no")
| search NOT dollar_sign=yes
0 Karma

jason_hotchkiss
Communicator

I will keep this in mind if I end up using this in a dashboard.  Thank you @ITWhisperer 

0 Karma

johnhuang
Motivator
| eval dollar_sign=IF(LIKE(host_value, "$%$"), "yes", "no")
0 Karma

jason_hotchkiss
Communicator

This solved my use case.  Thank you @johnhuang 

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...