Splunk Cloud Platform

How can i split the multiple events into fields and one field must be dynamic.

Annna
Explorer

my event is below :

6|1|1|12|1907|1|1|1219079|1|1|126G|19079|1|1|12NB|190|1|1|126G774_100_NB|1907|1|1|126G|19079

sometimes A field will change the number as 5, 7, 8 like 5rows and 7 rows will come so that A is dynamic.

ABCDE
611650_3M1921   
 111758749   
 115522   
 115533   
 115555   
 115566   
Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Change the first rex to this

| rex "^(?:([^\|]+\|){4})(?<A>[^\|]+)(?<NotA>.*)"

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I suspect the event you gave as an example is missing a pipe (and possibly data) between D and E in the second group and should have been?

6|1|1|12|1907|1|1|126G|19079|1|1|126G|19079|1|1|12NB|190|1|1|126G774_100_NB|1907|1|1|126G|19079

Assuming the missing pipe to be the case

| rex "(?<A>[^\|]+)(?<NotA>.*)"
| rex max_match=0 field=NotA "(?<BCDE>(\|[^\|]+){4})"
| mvexpand BCDE
| rex field=BCDE "\|(?<B>[^\|]+)\|(?<C>[^\|]+)\|(?<D>[^\|]+)\|(?<E>.+)"

 

0 Karma

Annna
Explorer

thank you so much for quick response. 

0 Karma

Annna
Explorer

this is my sample events 

|6|1|1|126G7|1907|1|1|126G7|19079|1|1|126G77|190795|1|1|126G7|190795|1|1|126G|1907|1|1|126G|1907

|7|1|1|126G7|19076|1|1|126G7|19079|1|1|126G77|190795|1|1|126G7|190795|1|1|126G|1907|1|1|126G|19078|1|1|126G7|19078|

i want output be like 

611650_3M1921   
 111758749   
 115522   
 115533   
 115555   
 115566   
711650_3M1921   
 111758749   
 115522   
 115533   
 115555   
 115566   
 115566   
3115566   
 115566   
 115566   
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Is the only difference the fact that A is repeated on the other rows? If so

| rex "(?<A>[^\|]+)(?<NotA>.*)"
| rex max_match=0 field=NotA "(?<BCDE>(\|[^\|]+){4})"
| mvexpand BCDE
| rex field=BCDE "\|(?<B>[^\|]+)\|(?<C>[^\|]+)\|(?<D>[^\|]+)\|(?<E>.+)"
| streamstats count as row by A
| eval A=if(row=1,A,null())
| fields - row
0 Karma

Annna
Explorer

Thank you so much. It is very helpful. 

If the event will be as below means

Abc|cbde1|elog|700|6|1|1|126G7|1907|1|1|126G7|19079|1|1|126G77|190795|1|1|126G7|190795|1|1|126G|1907|1|1|126G|1907

How can I slipt from |6 onwards. 

Once again, thanks quick response. 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Change the first rex to this

| rex "^(?:([^\|]+\|){4})(?<A>[^\|]+)(?<NotA>.*)"
0 Karma

Annna
Explorer

Its working Awesome. Thank you so much 😊

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Unlocking Unified Insights: New Gigamon Federated Search App for Splunk

In today’s data-heavy environment, organizations are caught in a data distribution dilemma. As data volumes ...

GA: New Data Management App in Splunk Platform

Streamlining Data Management: Introducing a unified experience in Splunk Managing data at scale shouldn’t feel ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...