Alerting

Is it possible to attach a log file to an alert when the alert is triggered?

aniketb
Path Finder

Hi,

Is it possible to attach the log file to the Splunk alert when the alert is triggered?

e.g.
if the alert is triggered, can it also attach the source file as part of alert email?

0 Karma

woodcock
Esteemed Legend

You cannot directly but you can extend your search by adding this to the end of it to recreate the log file:

| map [index=YourIndexHere source=$source$]

If your original search returns nothing, then so will this extension, but if it returns anything then it will reconstruct the entire file for each result.

0 Karma

sbbadri
Motivator

You will alert email with attachment based on your query output. That is your source right. You want attach external file along with the alert.

If you want result to be attached while alerting below is the link,
http://docs.splunk.com/Documentation/Splunk/6.4.2/Alert/Emailnotification

0 Karma

aniketb
Path Finder

let's say my query is:
index=myindex sourcetype=sample "error"

and the string is encountered in error.log file

I want splunk to email me the whole error.log file

0 Karma

DalJeanis
Legend

Okay, since that would be a file of an unknown size, it's probably not what you really want.

Probably, what you really want is for your alert to kick off a report that will extract certain kinds of records for a certain number of seconds or minutes from the log file and mail that to you.

So, YES, splunk can do that.

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

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...