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!

New Year, New Changes for Splunk Certifications

As we embrace a new year, we’re making a small but important update to the Splunk Certification ...

Stay Connected: Your Guide to January Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...

[Puzzles] Solve, Learn, Repeat: Reprocessing XML into Fixed-Length Events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...