Splunk Search

how to use a wild card in if condition in eval?

pavanae
Builder

I have an eval condition as below which is working good.

| eval Project=if(app=="abc_def_123", "XYZ", "ZXT")

Now If I have given a wild card as shown below it's not working. How can I apply the wild card as shown below and get the required results?

| eval Project=if(app=="abc_*", "XYZ", "ZXT")
0 Karma

woodcock
Esteemed Legend

You cannot; you must use something else like like or match or searchmatch like this:

... | eval Project=if(match(app, "^abc_"), "XYZ", "ZXT")
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 ...