Splunk Search

How to write a search to display a particular string if a certain condition is met?

Rias
New Member

If AVSResponse = x, then I need to display "matched" in the dashboard report. Likewise, if I have more than 10 value to be matched. Kindly help how I can set up the ssearch. thanks

0 Karma
1 Solution

renjith_nair
Legend

Have you tried if or case from http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/Commonevalfunctions

Eg:

... | eval description=case(error == 404, "Not found", error == 500, "Internal Server Error", error == 200, "OK")
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

Have you tried if or case from http://docs.splunk.com/Documentation/Splunk/6.1/SearchReference/Commonevalfunctions

Eg:

... | eval description=case(error == 404, "Not found", error == 500, "Internal Server Error", error == 200, "OK")
---
What goes around comes around. If it helps, hit it with Karma 🙂

ddrillic
Ultra Champion

Looks great. Just tried something like -
index=iiii | eval cat=case(host == "aaaa", "customer", host == "bbbb", "customer") and it works.

0 Karma

jplumsdaine22
Influencer

Be sure to accept renjith.nair's answer of it worked for you. That way people can see what to do.

Rias
New Member

@ ddrillic & Renjith.nair , thanks alot for sharing your knowledge. Great support ! executed the query successfully .

0 Karma
Get Updates on the Splunk Community!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

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

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...