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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...