Splunk Search

How to separate string with regex?

m0rt1f4g0
Explorer

Hi!

I would like to separate the field Privilegio

 

|---------------------------|-------------------------------------------------------------------------------------------|-------------|
|   src_user                      |      Privilegio                                                                                                                     |   count      |
|---------------------------|-------------------------------------------------------------------------------------------|-------------|
|   user-RAC0308$      | SeSecurityPrivilege                                                                                                      |    8127     |
|                                          |                                          SeBackupPrivilege                                                               |                    |
|                                          |                                          SeRestorePrivilege                                                               |                    |
|                                          |                                          SeTakeOwnershipPrivilege                                               |                    |
|                                          |                                          SeDebugPrivilege                                                                  |                    |
|                                          |                                          SeSystemEnvironmentPrivilege                                      |                    |
|                                          |                                          SeLoadDriverPrivilege                                                         |                    |
|                                          |                                          SeImpersonatePrivilege                                                      |                    |
|                                          |                                          SeDelegateSessionUserImpersonatePrivilege          |                    |
|                                          |                                          SeEnableDelegationPrivilege                                            |                    |
|                                          |                                          SeCreateTokenPrivilege                                                      |                    |
|                                          |                                          SeAssignPrimaryTokenPrivilege                                      |                     |
|---------------------------|--------------------------------------------------------------------------------------------|--------------|

 

Since it only counts the first value and the others are put with a tab, they are the windows privileges of the EventID 4672,  my query is the following:

index=oswinsec EventCode=4672
| stats values(PrivilegeList) as Privilegio count by src_user

m0rt1f4g0_0-1668840333515.png

 

Labels (5)
Tags (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Does this help?

index=oswinsec EventCode=4672
| stats count by src_user PrivilegeList
0 Karma

m0rt1f4g0
Explorer

@ITWhisperer Hi,

No, I think the field takes it as a single string

 

m0rt1f4g0_0-1668849973099.png

 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

In that case, you need to split PrivilegeList first.

index=oswinsec EventCode=4672
| eval PrivilegeList = split(PrivilegeList, "
       ") ``` include the proper indentation characcter(s) ```
| eval SeSecurityPrivilege = mvindex(PrivilegeList, 1, mvcount(PrivilegeList))
``` the first line, SeSecurityPrivilege, is a mere header ```
| stats values(SeSecurityPrivilege) as Privilegio count by src_user

 

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...