Splunk Search

Can i extract a dataset from a single column and show it as another field

NS
Explorer

Hey Splunkers!

I have several events from a particular index, and am looking to extract field value pair from one of the fields.

Sample  event:

DescriptionType
Attribute: environment=PROD\nAttribute: severity=MAJOR\nAttribute: time_ins=2020-11-30T17:45:33\nAttribute: affected_aspect=Exit\nAttribute: plane=Prod\nAttribute: workflow_state=NewALERT

 

I need each of these attributes as another column in the search.

environmentseveritytime_insaffected_aspectplaneworkflow_stateType
prodMAJOR2020-11-30T17:45:33ExitProdNewALERT

 

Can someone please guide me?

Thank you!

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The process is a bit convoluted since the extract command only works on the _raw field.  Here is an example

| makeresults | eval description="Attribute: environment=PROD\nAttribute: severity=MAJOR\nAttribute: time_ins=2020-11-30T17:45:33\nAttribute: affected_aspect=Exit\nAttribute: plane=Prod\nAttribute: workflow_state=New"
```The above just sets up test data```
| rename _raw as old_raw, description as _raw
| rex mode=sed s/\\\nAttribute://g
| extract pairdelim="\\" kvdelim="="
| rename _raw as description, old_raw as _raw

 

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

View solution in original post

NS
Explorer

This is exactly what i was looking for!

Thanks a lot.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The process is a bit convoluted since the extract command only works on the _raw field.  Here is an example

| makeresults | eval description="Attribute: environment=PROD\nAttribute: severity=MAJOR\nAttribute: time_ins=2020-11-30T17:45:33\nAttribute: affected_aspect=Exit\nAttribute: plane=Prod\nAttribute: workflow_state=New"
```The above just sets up test data```
| rename _raw as old_raw, description as _raw
| rex mode=sed s/\\\nAttribute://g
| extract pairdelim="\\" kvdelim="="
| rename _raw as description, old_raw as _raw

 

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

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...