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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...