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 Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...