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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...