Reporting

Using $result.fieldname$ in email text/body (splunk email alert)

nadlurinadluri
Communicator

I am trying to use results of an alert and send it as a slack message. The output of the alert has two rows and two columns. How to send all the output in the body? Using $result.fieldname$ gives only the first row of that field. How can we get the second row too, of that field and show that in the body?

0 Karma
1 Solution

burwell
SplunkTrust
SplunkTrust

So let's say you were searching for

  index="foo" "some error condition"

You could create a new field by combining two fields together

 index="foo" "some error condition" 
   | eval newfield=field1 + " " + field2
   | stats values(newfield) as newfieldValues

And then use $result.newfieldValues$ in slack.

Sometimes I combine the fields with an =

For example

   index="foo" "some error condition"
   | eval hostsAndValue=host + "=" + somefield
   | stats values(hostsAndValue) as badHosts

Then I use $result.badHosts$ in slack.

View solution in original post

0 Karma

burwell
SplunkTrust
SplunkTrust

So let's say you were searching for

  index="foo" "some error condition"

You could create a new field by combining two fields together

 index="foo" "some error condition" 
   | eval newfield=field1 + " " + field2
   | stats values(newfield) as newfieldValues

And then use $result.newfieldValues$ in slack.

Sometimes I combine the fields with an =

For example

   index="foo" "some error condition"
   | eval hostsAndValue=host + "=" + somefield
   | stats values(hostsAndValue) as badHosts

Then I use $result.badHosts$ in slack.

0 Karma

nadlurinadluri
Communicator

Sorry for the delay!! But I did something similar, to get the required output!! After getting the output with many rows, I combined those values in a single filed (multi valued field; using mvappend)

0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...