Splunk Search

Can I fill null results of a field with results from another field?

anthony_copus
Explorer

Hi,

I'm currently looking at partially complete logs, where some contain an article_id, but some don't. Is it possible to take a value from a different field (video_id) to populate that field when is it null? Currently I'm trying to use this query:

index="video" | fillnull value=video_id article_id

Obviously it's intended to put the value from the video_id into article_id where article_id is null, but it only puts the string "video_id" instead. Is there a way around this?

Anthony

1 Solution

somesoni2
Revered Legend

Use Eval-Coalesce instead

index="video" | eval article_id=coalesce(article_id,video_id) |...

This will take the first non-null value from article_id,video_id and populate to article_id.

View solution in original post

somesoni2
Revered Legend

Use Eval-Coalesce instead

index="video" | eval article_id=coalesce(article_id,video_id) |...

This will take the first non-null value from article_id,video_id and populate to article_id.

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