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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...