Splunk Search

Combine fields into new field without NULL

arrowecssupport
Communicator

From our data we end up with 2 different fields v7serial & v8serial. I want to be able to feed this into a single serial v78serial.

Example of data
v7serial
987654321

v8serial
123456789

v78serial
123456789
987654321

I am trying

| eval v78serial= toString(v8serial) + ";" + toString(v7serial)
| makemv delim=";" allserials
| mvexpand v78serial | table v78serial

The problem is when i display this data or try to use this field i get "123456789;null" this is because the data has either a v7 or v8 serial never both. So where one field is Null then don't add it to the new field.

Tags (2)
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try like this

your base search | eval v78serial=coalesce(v8serial,v7serial,"")  | table v78serial

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Try like this

your base search | eval v78serial=coalesce(v8serial,v7serial,"")  | table v78serial
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...