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!

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

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...