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
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 ...