Splunk Search

How to replace blank values with "0"?

harshparikhxlrd
Path Finder

Trying to replace the blank values on my dashboard with 0s. If table is empty, should display 0. On the logs data, it is simply blank.

Labels (1)
0 Karma
1 Solution

aberkow
Builder

Since you said you tried fillnull, I'm guessing they're being read in as empty strings. For that specific column, you can specifically try

| eval invalid=if(isnull(invalid) OR invalid="", 0, invalid)
Otherwise fillnull value=0 should fill any fields that are null. You can also check if the column is actually null or not by doing this:

| eval isInvalidNull=if(isnull(invalid), 1, 0)
and compute this column just to validate that theory

View solution in original post

aberkow
Builder

Since you said you tried fillnull, I'm guessing they're being read in as empty strings. For that specific column, you can specifically try

| eval invalid=if(isnull(invalid) OR invalid="", 0, invalid)
Otherwise fillnull value=0 should fill any fields that are null. You can also check if the column is actually null or not by doing this:

| eval isInvalidNull=if(isnull(invalid), 1, 0)
and compute this column just to validate that theory

TrangCIC81
Communicator

@aberkow wrote:

Otherwise fillnull value=0 should fill any fields that are null.



Works for me. 

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

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...