Splunk Search

Combining fields

gagareg
Explorer

How to combine three fields in one field and display it as table? I need one field called emails consisting of from, to and user fields

alt text

alt text

Tags (4)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @gagareg,
in each event do you have only one value (to or from or user) or could you have in the same event more fields?

If you have only one field for event, you can use coalesce function:

| eval email=coalesce(to,from,user)

If instewad you surely have all the three fields in each event, you can use a solution like the one of @harsmarvania57

| eval email=to."--".from."--".user

if you could have more fields in the same event but you're not sure that there are always all the three fields, you have to add a value to the three fields when there's no value before the eval row:

| eval to=fillnull(to,"-"), from=fillnull(from,"-"), user=fillnull(user,"-")
| eval email=to."--".from."--".user

otherwise the eval command doesn't run.

Ciao.
Giuseppe

0 Karma

harsmarvania57
SplunkTrust
SplunkTrust

HI,

Try below query

<your base search> | eval new_field = field_1 . "--" . field_2 . "--" . field_3
0 Karma

gagareg
Explorer

Unfortunately, it does not work.

0 Karma
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 ...