Splunk Search

How to combine or merge two or more fields?

m0rt1f4g0
Explorer

Hi.

How do I combine these two fields, since the username is similar?

The result of my query is the following:

user                                                                                                  EventID        count
----------------------------------------------------------------- |------------|------------ |
dsanchez.ext3                                                                         |   4740     |     3            |
----------------------------------------------------------------- |------------|------------ |
dsanchez.ext3                                                                         |   4767     |      3           | 
----------------------------------------------------------------- |------------|------------ |
dsanchez.ext3@domain.com                                           |   4625     |    10          |
----------------------------------------------------------------- |------------|-------------|

I would like the following:

user                                                           EventID                                    count
-----------------------------------------------------|------------------- |--------------|
dsanchez.ext3                                                     |       4740             |        3           |
dsanchez.ext3                                                     |       4767             |        3           |
dsanchez.ext3@domain.com                       |      4625              |       10         |
-----------------------------------------------------------------------------------------

My query is:

index=oswinsec user=dsanchez* EventID=4625 OR EventID=4740 OR EventID=4767
|stats count by user, EventID

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval u=mvindex(split(user,"@"),0)
| stats list(*) as * by u
| fields - u

View solution in original post

m0rt1f4g0
Explorer

@ITWhisperer Thanks! 🙂 🤓

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eval u=mvindex(split(user,"@"),0)
| stats list(*) as * by u
| fields - u
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

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