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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...