Knowledge Management

How do I populate a summary index with the collect command if a field value is an empty string and will become a null value?

chanmi2
Path Finder

In order to create a timestamp with a specific field, my search is like

search xxx| eval _raw=FIELD_TIME.", FIELD_A=\"".FIELD_A."\", FIELD_B=\"".FIELD_B."\"" | collect index=yyy

But if FIELD_A is an empty string and it will become a null value in index=yyy. Anyone know how to fix it? Thanks

0 Karma

somesoni2
Revered Legend

Try something like this

search xxx| eval _raw=FIELD_TIME.", FIELD_A=\"".coalesce(FIELD_A,"")."\", FIELD_B=\"".FIELD_B."\"" | collect index=yyy
0 Karma

chanmi2
Path Finder

It does not work

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use the fillnull command to replace null values with something else. This command replaces all null values with a single space, but you can limit it to FIELD_A if you wish.

search xxx| fillnull value=' ' | eval _raw=FIELD_TIME.", FIELD_A=\"".FIELD_A."\", FIELD_B=\"".FIELD_B."\"" | collect index=yyy
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...