Splunk Search

How do I extract nested key-value pairs from my sample data to use in an email alert?

mattnovak
Explorer

I'm attempting to use some KV pairs as tokens (i.e., $result.configuration$ and $result.version$) in an email alert. How do I go about extracting the KV pairs out in the search, including the nested KV pairs from the 'message' field?

[2016-04-28 23:09:17-0600]  build_id=a93737e configuration=blackrussian caller=_deploy-video-client level=lifecycle lifecycle='CMDB' message='event=deploy user=hudson component=video-client version=1.0.3-49 platform=darwin arch=x86_64 target=blackrussian'

Thanks in advance for the help!

0 Karma
1 Solution

mattnovak
Explorer

Ok, so I figured it out. If I pipe the search result to the fields command, then the autoextraction thing works. So it's just " | fields configuration, component, etc...", and that gives me my tokens for use in the email.

Just dropping that there in case anyone else has the same issue. Thanks for the help!

View solution in original post

0 Karma

mattnovak
Explorer

Ok, so I figured it out. If I pipe the search result to the fields command, then the autoextraction thing works. So it's just " | fields configuration, component, etc...", and that gives me my tokens for use in the email.

Just dropping that there in case anyone else has the same issue. Thanks for the help!

0 Karma

somesoni2
Revered Legend

Is the kv pair not automatically extracted as fields in Splunk? By using KV value as token, where do you want to use in email alert (subject/body etc)?

mattnovak
Explorer

It doesn't seem to be. And yes, I'm trying to inject them into an tokenized string and the email keeps coming in with null token results.

For instance,

CMDB: $result.configuration$ $result.component$ Deployment

comes in as

CMDB: Deployment

0 Karma

somesoni2
Revered Legend

What is your email alert search that you're using?

0 Karma
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, ...