Splunk Search

Top syntax to display null fields when using 'by'?

Tisiphone_1
Explorer

When I use 'top' to create a top n list of fields, and I add two fields, using by, so:

top field1 by field2

if either field is not present in a result, it does not display in the list. I want to display events in my results even the secondary field is null. Is there any way to do this?

For example:

top infected person by infection

Even if I don't know what infection it is, I still want them to show up on the list of infected people, and I still want to see the infection if it is available.

1 Solution

Stephen_Sorkin
Splunk Employee
Splunk Employee

The best way to do this is to use the fillnull command to make the desired fields dense. In this case, you could try:

... | fillnull value=NULL person infection | top person by infection

View solution in original post

Tisiphone_1
Explorer

Thanks a ton, Stephen!

0 Karma

Stephen_Sorkin
Splunk Employee
Splunk Employee

The best way to do this is to use the fillnull command to make the desired fields dense. In this case, you could try:

... | fillnull value=NULL person infection | top person by infection
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...