Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sthota
Partner - Contributor
Partner - Contributor

Send an email alert for a failed task

Need to send an email alert for failed tasks. 

I have tried updating the LocalLogConfig.xml as follows

<?xml version="1.0"?>
<configuration>
<appender name="sendMail" type="log4net.Appender.SmtpAppender">
<filter type="log4net.Filter.LevelRangeFilter">
<param name="levelMin" value="ERROR" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<evaluator type="log4net.Core.LevelEvaluator">
<param name="threshold" value="ERROR"/>
</evaluator>
<param name="to" value=""/>
<param name="from" value=""/>
<param name="subject" value="Qlik Sense"/>
<param name="smtpHost" value="smtp.office365.com"/>
<param name="port" value="587"/>
<param name="EnableSsl" value="true"/>
<param name="Authentication" value="Basic"/>
<param name="username" value=""/>
<param name="password" value=""/>
<param name="bufferSize" value="0" /> <!-- Set this to 0 to make sure an email is sent on every error -->
<param name="lossy" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="conversionPattern" value="%newline%date %-5level %newline%property{TaskName}%newline%property{AppName}%newline%message%newline%newline%newline" />
</layout>
</appender>
<logger name="System.Scheduler.Scheduler.Slave.Tasks.ReloadTask">
<appender-ref ref="sendMail" />
</logger>
</configuration>

C:\ProgramData\Qlik\Sense\Scheduler

its not working.

Labels (2)
2 Replies
mountaindude
Partner Ambassador
Partner Ambassador

I haven't sent emails to Office365 using this method, but to lots of other email servers so it does work.

I have long since abandoned this model though in favour of more feature rich emails. Getting better alert emails was actually one of the driving factors behind the development of the Butler tool, which among other things does exactly this: Reload failed alerts to email, Slack, Teams, incident management tools and webhooks.

So... you have two options if you want to get close to real-time alerts when reloads fail:

1. Use a log appender like the one you've tried. This will give you rudimentary emails with no formatting and little context. You will know that a reload task failed, but not much more. 
If you want to take a look at another XML file sample there is one here in Butlers repository on GitHub. Maybe it can give some ideas on what's not working in your current setup.

2. Use a tool like Butler, https://butler.ptarmiganlabs.com. Butler is open-source and thus free to use. It's used by large and small companies around the world with good result. A sample alert email is shown below.
More examples and discussion around alert emails is found here: https://butler.ptarmiganlabs.com/docs/concepts/alert-emails/ 

If you don't care about the real-time aspects of alerts you could also consider writing a Sense app that  parses the Sense log files, looking for failed reloads. And then use the web connectors to send alert emails.
That will be slow, use Sense to do something it's not really good at and generally a bad idea, IMHO.. But still possible.

Transparency note: I am the creator of Butler and thus biased. But I have tested lots of different options for doing failed reload alerts and found Butler to be the most effective and best by far. But others go different routes, of course.

 

mountaindude_0-1651592261294.png

 

Please mark the post as a solution if it provided you with a solution to the topic at hand. Thanks!
mountaindude
Partner Ambassador
Partner Ambassador

Oh, this image might be useful to understand how Butler works on a high level:

mountaindude_1-1651592610901.png

 

Please mark the post as a solution if it provided you with a solution to the topic at hand. Thanks!