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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...