All Apps and Add-ons

Splunk App for AWS: JSON formatting for AWS SNS alert

sduchene_splunk
Splunk Employee
Splunk Employee

I need to pass JSON formatted data to the AWS SNS alert.
What I have is a table. I created an SNS alert (save as alert->choose AWS SNS)
When sent through SNS alert the format is not JSON.
How can I format this table in JSON?

0 Karma

sduchene_splunk
Splunk Employee
Splunk Employee

idea 1 : use the json tool app https://splunkbase.splunk.com/app/3540/ (note, i haven't tried it, but seems to do the job)
idea 2 : use SPL to create a new field containing the entire line into JSON format, and pass this field to sns alert

this uses foreach command,

index=xx
| eval message="{"
| foreach *
[eval message=if("<>"="message", message, message. " \"". "<>" . "\" : \"".<>."\", ")]
| eval message=rtrim(message, " ,")| eval message=message." }"

--
then finally pass the field message : $result.message$ to sns alert

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...