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!

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...

Adoption of Infrastructure Monitoring at Splunk

  Splunk's Growth Engineering team showcases one of their first Splunk product adoption-Splunk Infrastructure ...

Modern way of developing distributed application using OTel

Recently, I had the opportunity to work on a complex microservice using Spring boot and Quarkus to develop a ...