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!

Introducing a Smarter Way to Discover Apps on Splunkbase

We’re excited to announce the launch of a foundational enhancement to Splunkbase: App Tiering. Because we’ve ...

How to Send Splunk Observability Alerts to Webex teams in Minutes

As a Developer Evangelist at Splunk, my team and I are constantly tinkering with technology to explore its ...

.conf25 Registration is OPEN!

Ready. Set. Splunk! Your favorite Splunk user event is back and better than ever. Get ready for more technical ...