Splunk Search

How to compare and calculate comparison flag for two fields

mbasharat
Builder

Hi, 

I have below scenario. My brain is very slow at this time of the day!

I need an eval to create Status field as in the table below that will flag a host if it is running on IPv4 OR IPv6 OR both IPv4 +IPv6

HOSTNAMEIPv4IPv6Status
SampleA0.0.0.1 IPv4
SampleB 0.0.0.2IPv6
SampleC0.0.0.3A:B:C:D:E:FIPv4 + IPv6


Thanks in-advance!!!

Labels (5)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

There may be a few ways to do that.  Here's one.

| eval Status = case(isnotnull(IPv4) AND isnotnull(IPv6), "IPv4 + IPv6",
                     isnotnull(IPv4), "IPv4",
                     isnotnull(IPv6), "IPv6",
                     1==1, "")
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

mbasharat
Builder

Thanks @richgalloway!!

richgalloway
SplunkTrust
SplunkTrust

There may be a few ways to do that.  Here's one.

| eval Status = case(isnotnull(IPv4) AND isnotnull(IPv6), "IPv4 + IPv6",
                     isnotnull(IPv4), "IPv4",
                     isnotnull(IPv6), "IPv6",
                     1==1, "")
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...