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!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...