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!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...