Splunk Search

Search for a value in a Table column

harshal_chakran
Builder

Hi,
I have used inputcsv to get the following table
Parameter Value
p1 1
p2 2
p3 3
p4 0

Is there any way to add another column "Result" which tells me if "Value" column contains numerical 0, the "Result" value will be shown as "Red" else "Green"
i.e.

Parameter Value Result
p1 1 Red
p2 2 Red
p3 3 Red
p4 0 Red

Please Help...!!!

Tags (3)
1 Solution

jeffland
SplunkTrust
SplunkTrust

Yes, simply eval that field:

inputlookup ... | eval Result=if(match(Value, "0"),"Red","Green")

match in eval expects a regular expression as its second argument, so you can adjust that to your needs.

View solution in original post

jeffland
SplunkTrust
SplunkTrust

Yes, simply eval that field:

inputlookup ... | eval Result=if(match(Value, "0"),"Red","Green")

match in eval expects a regular expression as its second argument, so you can adjust that to your needs.

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...