Splunk Search

Quick Question: eval

wyang6
Path Finder

I have a chart:

Los Angeles   New York   Boston   Washington D.C.   Total
5             3                   2                 10

and

... | eval "x"='New York'+'Washington D.C'

returns x=5. However,

... | eval "x"='New York'+'Boston'+'Washington D.C'

returns an empty value, i.e. x=

How do I get around this problem where 'Boston' is empty?

Thank you.

Tags (1)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

use the ifisnull() or coalesce() function:

... | eval "x"=coalesce('New York',0)+coalesce('Boston',0)+ifisnull('Washington D.C',0,'Washington D.C')

Or you could use the | fillnull search command.

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

use the ifisnull() or coalesce() function:

... | eval "x"=coalesce('New York',0)+coalesce('Boston',0)+ifisnull('Washington D.C',0,'Washington D.C')

Or you could use the | fillnull search command.

bwooden
Splunk Employee
Splunk Employee

I had

... | fillnull value=0 'Los Angeles' 'New York' 'Boston' 'Washington D.C.' | eval x='New York'+'Boston'+'Washington D.C'

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...