Splunk Search

Joining two fields together

Michael_Schyma1
Contributor

How do I join two fields together so there is not whitespace in my table. I want to join sfailed and EventCodeDescription so that it will list "Shutdown or reboot"

index="Desktop" (EventCode=513 OR EventCode=3003) OR reboot EventCodeDescription= "sfailed" OR "Shutdown"| rex"Shutdown\s\S+(?\s\S+)" | table _time sfailed host user EventCodeDescription | rename _time AS Time | convert timeformat="%H/%M/%S %d.%m.%Y" ctime(Time) | rename user AS Username | rename host AS "Machine Name" EventCodeDescription AS "Description"

Tags (1)
0 Karma
1 Solution

MHibbin
Influencer

You should probably use eval to create a new field, and then use coalesce to combine these two fields. e.g.

...| eval newField=coalesce(EventCodeDescription,sfailed)|...

View solution in original post

MHibbin
Influencer

You should probably use eval to create a new field, and then use coalesce to combine these two fields. e.g.

...| eval newField=coalesce(EventCodeDescription,sfailed)|...

sowings
Splunk Employee
Splunk Employee

Coalesce is probably not what you want; it picks the first non-null from the list and returns that. Instead, string manipulation will do what you want:


eval newField=EventCodeDescription + sfailed

Get Updates on the Splunk Community!

Your Guide to Splunk Digital Experience Monitoring

A flawless digital experience isn't just an advantage, it's key to customer loyalty and business success. But ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...