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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...