- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to break out multiple values into a new column?

- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So something like
| mvjoin(colc, ":")
| rex field=colc "x,(?<colcx>\d+):y,(?<colcy>\d+):z,(?<colcz>\d+)"
| table cola colb colcx colcy colcz cold
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I feel like there should be a more elegant way to do this, maybe something with map or foreach...
| eval extrakey=md5(tostring(_time)+tostring(colc))
| mvexpand colc
| rex field=colc "^(?<fname>[^,]*),(?<fvalue>.*)$"
| eval colc.{fname}=fvalue
| fields - fname, fvalue, colc
| stats values(*) as * by extrakey
Apologies for dropping the hyphen from your field names. This solution works for n-number of pairs in colc. This solution does NOT work well for large datasets where mvexpand blows you up. The "extrakey" business is because I tested with synthetic data. Depending on your circumstance, you might want to calculate that differently, or just use _raw.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

If the number of element in the field col-c is always 3, this
1) if first values in the mv field (e.g. x OR y OR z) is constant, try this
Your current search so far | eval "col-c.x"=mvindex(split(mvindex('col-c',0),","),1) | eval "col-c.y"=mvindex(split(mvindex('col-c',1),","),1) | eval "col-c.z"=mvindex(split(mvindex('col-c',2),","),1) | fields - "col-c"
2) If the values in mvfield (e.g. x OR y OR z is dynamic, try this
Your current search so far | eval fieldname1=mvindex(split(mvindex('col-c',0),","),0) | eval fieldname2=mvindex(split(mvindex('col-c',1),","),0) | eval fieldname3=mvindex(split(mvindex('col-c',2),","),0) | eval "col-c.{fieldname1}"=mvindex(split(mvindex('col-c',0),","),1) | eval "col-c.{fieldname2}"=mvindex(split(mvindex('col-c',1),","),1) | eval "col-c.{fieldname3}"=mvindex(split(mvindex('col-c',2),","),1) | fields - fieldname* "col-c"
Please ensure that you update the field names and prefix as per yours.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was just typing that out. Good work with the dynamic field names.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Is the no of element fixed for column C? (example show 3, will it always be 3 or will it be dynamic)
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

it will always be 3
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

The only way I could create it was to do a table with col-a, col-b, and col-d and join that with an xyseries of col-c. However, this slows down the search.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Last question, will the values x,y,z will also be constant OR they can change?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

xyz will always be constant
