Splunk Search

How to Remove the null values in a field for particular type only.

vinod743374
Communicator

HI,

I have a single query to get all types of data in table.
for one particular type I have an issue with the null values, i need to remove those null value results for the particular type only without effecting the other types of data.

vinod743374_0-1711167321001.png

I need to remove those null values in that "error message" field for type 1 , for Type 2 it should be as it is.


Thanks in advance.

Labels (3)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

The question is next to unanswerable.  First, what does "type" mean?  Is that a field name?  Attempting to show data using screenshot is bad enough, but the screenshots only includes one column.  Do we assume that there is another column named "type", and the values are "type1" and "type2"?  Pro tip #1: Illustrate data in text.  Tabulate with mock values if you want to anonymize.

Second, what does "remove" mean?  Do you want to remove the row that contains null value in this field named "error message"?  As if using single-column screenshot is not confusing enough, your screenshot shows a heading "ErrorMessage" with so-called camel case and no space.

Now, forget type because it doesn't seem to have any bearing in the question, just add to overall confusion. If you ask how to remove a row with null value in a given field such as one named "error message", all you need to do is to test it using isnull or isnotnull.

| where isnotnull('error message')

Is this what you ask?

Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @vinod743374 ,

use eval:

| eval ErrorMessage=if(ErrorMessage="Type1","Your message for Error Type 1",ErrorMessage)

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

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

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...