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!

Routing Data to Different Splunk Indexes in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. The OpenTelemetry project is the second largest ...

Getting Started with AIOps: Event Correlation Basics and Alert Storm Detection in ...

Getting Started with AIOps:Event Correlation Basics and Alert Storm Detection in Splunk IT Service ...

Register to Attend BSides SPL 2022 - It's all Happening October 18!

Join like-minded individuals for technical sessions on everything Splunk!  This is a community-led and run ...