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!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...