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! :slightly_smiling_face: :nerd_face:

0 Karma

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

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...