Splunk Search

Help with regex needed

damucka
Builder

Hello,

I am trying to extract the system IDs from single event into the multiple events, I mean that each SID is in a separate line. I try to deploy a regex for this, without success.

Could perhaps anyone help with the below?

Kind Regards,

Kamil

 

| makeresults
| eval 
SID="I32
DYR
DZ1
MHW
DYN
I58
ICZ
ICN
I69
I8Y
IAE
I6J
I71
SLG
I9Z
I7T
I7Z
I5Y
I5U
I5T
I3I
I3G
TCX
I5O
DZX
DZC
DYQ
DYO
DYM
OGO
OJ8
OK8
OKQ
OKX
DXF
DYE
DYF
SS4
QMW
I24
R9H
O67
OP0
SP9
I4I
I4M"

| rex field=SID "^(?<SID2>[^\r\n].+)"

 

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

By default, the rex command returns a single match.  Use the max_match option to change that.  Then use the mvexpand command to split the field into separate events.

 

| rex field=SID max_match=0 "(?<SID2>.+[^\S]+)"
| mvexpand SID2

 

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

By default, the rex command returns a single match.  Use the max_match option to change that.  Then use the mvexpand command to split the field into separate events.

 

| rex field=SID max_match=0 "(?<SID2>.+[^\S]+)"
| mvexpand SID2

 

 

---
If this reply helps you, Karma would be appreciated.

damucka
Builder

Unfortunately this solution does not work, still getting just the first match only

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I modified the regex.  Please try the revised query.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...