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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...