Splunk Search

How to use If and Not statement in one pass?

splunker1981
Path Finder

Hello all,

What's the best way to use a NOT statement in an if statement. I'm trying to accomplish something similar to the below.

| eval x_height=if(isnull(x_height) AND NOT (sourcetype=mysourcetypeHere),"Not Defined",x_height)
Tags (2)
0 Karma
1 Solution

woodcock
Esteemed Legend

This is more clear:

| eval x_height=if((sourcetype=="mysourcetypeHere"), null(), coalesce(x_height, "Not Defined")) 

View solution in original post

0 Karma

woodcock
Esteemed Legend

This is more clear:

| eval x_height=if((sourcetype=="mysourcetypeHere"), null(), coalesce(x_height, "Not Defined")) 
0 Karma

splunker1981
Path Finder

That worked, thanks!

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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