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 Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...