Splunk Search

setting field values

kenchisho
Path Finder

Hi guys,

how doi go about setting a field value if it is empty...

I have a field prefix... i use this field when i do a lookup to a csv file... in certain events the field prefix is empty "" and in those cases i would like to set it to 033 so it matches the lookup...

i tried using eval prefix=if(prefix="","033",prefix) but this does not work...

any ideas

Tags (2)
0 Karma
1 Solution

southeringtonp
Motivator

Use coalesce:

| eval prefix=coalesce(prefix,"033")

or alternateively, edit your lookup table definition to to return a default value.

View solution in original post

0 Karma

southeringtonp
Motivator

Use coalesce:

| eval prefix=coalesce(prefix,"033")

or alternateively, edit your lookup table definition to to return a default value.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...