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!

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,  ...