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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...