Other Usage

How to send table format query result from Splunk to Slack?

skumarr
New Member

Screenshot 2023-04-30 at 12.40.33 PM.png

 

I have a requirement where i want send the above query result from splunk to slack as an FYI alert. But somehow i am not able to achieve it and i am unable find the right documents to processed. I did try to print using  $result.req$ $result.method$ and $result.percentile99$ but i get to see the slack message for just 1st row. 
But i would need the complete query to be shown in slack message. How do i achieve this ?

 

@ITWhisperer or anyone please help me out here

Tags (1)
0 Karma

skumarr
New Member

Can you help me with some examples @PickleRick  on how to return list of rows into 1 single row and get that displayed in slack

0 Karma

PickleRick
SplunkTrust
SplunkTrust

It really depends on what you want to achieve but the easiest thing for starters would be to do

| stats values(*) as *

 

0 Karma

burwell
SplunkTrust
SplunkTrust

Yes so you can only refer to field names but not get multiple values of a field so you need to use stats or eval to create the fields you want 

So like @PickleRick suggests 

stats values(*) AS *

And then use the actual fieldname in the body of the Slack alert eg $yourfield$

Here are more ideas https://community.splunk.com/t5/Splunk-Search/How-do-I-make-a-custom-alert-message-with-variables/m-...

0 Karma

PickleRick
SplunkTrust
SplunkTrust

I don't know this particular add-on so I'm only speculating here but it is possible that the action allows only sending a single row from the results. In that case you'd have to either modify the script to include more rows (which might be tricky and will give you additional maintenance burden in the future) or you can rework your search to return values in a single row (possibly using multivalued fields)

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...