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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...