Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
There´s a common request to any Qlik Sense Enterprise Administrator:
"Is there any way to be informed by e-mail when a reload task fails?" Yes, there is!
Before that, let´s have some technical small talk (you can jump to session "Creating your config xml" if you want)
Qlik Sense Enterprise relies on log4Net a very mature Apache Project that is very reliable and powerful. It, besides a lot of features , has the concept of Appender. That concept means that the application being logged (Qlik Sense in our case) does not to take care where the log is being stored, log4net config files handles this.
You can change a config file and choose if your log are meant to be stored into a database, a flat file, a hadoop data lake and you can even send an e-mail for each error message. Qlik Sense Enterprise help to Appenders
1 - Creating your config xml
Pick your favorite text editor and write your config file according this https://logging.apache.org/log4net/release/config-examples.html
No, wait!
I´m posting here a functional config file, you can copy and paste it.
I´m supposing you´re going to use Gmail as the SMTP but is up to you chose any working SMTP that you want
<?xml version="1.0"?>
<configuration>
<!-- Mail appender-->
<appender name="MailAppender" type="log4net.Appender.SmtpAppender">
<filter type="log4net.Filter.LevelRangeFilter">
<param name="levelMin" value="WARN" />
<param name="levelMax" value="ERROR" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<evaluator type="log4net.Core.LevelEvaluator">
<param name="threshold" value="ERROR"/>
</evaluator>
<param name="to" value="admin@domain.com" /> <!-- please use your admin e-mail address here -->
<param name="cc" value="someone.else@domain.com" />
<param name="from" value="yourgmailaccount@gmail.com" /> <!-- you´re supposed to change this -->
<param name="subject" value="Qlik Sense Task Fail!!!" />
<param name="smtpHost" value="smtp.gmail.com" />
<param name="port" value="587" />
<param name="EnableSsl" value="true" />
<param name="Authentication" value="Basic" />
<param name="username" value="yourgmailaccount@gmail.com" /> <!-- you´re supposed to change this -->
<param name="password" value="yourpasswordforGmail" /> <!-- you´re supposed to change this -->
<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">7
<!-- You can change below code if you want to pretify your e-mail message -->
<param name="conversionPattern" value="%newline%date %-5level %newline%property{TaskName}%newline%property{AppName}%newline%message%newline%newline%newline" />
</layout>
</appender>
<!--Send mail on task failure-->
<logger name="System.Scheduler.Scheduler.Slave.Tasks.ReloadTask"> <!-- Filter what kind of exceptionname is beeing captured -->
<appender-ref ref="MailAppender" />
</logger>
</configuration>
2 - Saving your config xml
You must save your file with LocalLogConfig.xml name and under C:\ProgramData\Qlik\Sense\Scheduler (at least until version April2018). Anything different from this will cause your configuration not work.
3 - Restarting your Scheduler Service
Check if any task is running before restarting the service!!
4 - Test
Get a cup of coffee and wait for your task fail and your alert e-mail arrives at your inbox.
This blog post was written with fundamental contribution of ile that sent me a functional config file
Can we send email notification based on tasks? Say for Task A failure email should go to person A and for Task B failure it should go to Person B? I am looking for personalized notification if possible.
Thanks,
Jai
In my case this method does not work, i use gmail smtp.
It works like a charm (Sept 18 SR2)
Thanks a lot
I cant get it to work either. I have confirmed that the email-settings are correct, since i use them in Nprinting. But when the task fail, nothing happens. Is there a log i can use for troubleshooting?
Hi
Great post and I've managed to set everything up, so that I am able to receive an email alert every time an app fails to reload.
I would like to take it a step further and add the task name to the subject line.
Is this possible?
If so, how would I write this into the config file?
Kind regards
Mike Rowe
We've been trying this every which way but no luck. We're using Sept 2018 Sense - hoping that's not the issue.
We're not even getting any record of an email being sent. We contacted Qlik support but this is one of those areas they're only going to refer us to the acct rep.
Anyone else have problems with the configuration or where the xml file needs to be ?
If we get this working, we would like to see application, time of failure error code/description in the email.
We were able to resolve this from a support page which has an example of the xml config.
https://support-cdn.qlik.com/QS_CaseWizardKnowledgeArticle?Id=ka5D0000000TR9zIAG
<?xml version="1.0"?>
<configuration>
<!-- Mail appender-->
<appender name="MailAppender" type="log4net.Appender.SmtpAppender">
<filter type="log4net.Filter.LevelRangeFilter">
<param name="levelMin" value="ERROR" />
<!--Sets the level of logging, in this case any ERROR in the log will be sent as an email-->
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
<evaluator type="log4net.Core.LevelEvaluator">
<param name="threshold" value="ERROR"/>
<!--Sets the level of logging, in this case any ERROR in the log will be sent as an email-->
</evaluator>
<param name="to" value="you@gmail.com" />
<param name="from" value="you@gmail.com" />
<param name="subject" value="Qlik Sense" />
<param name="smtpHost" value="smtp.gmail.com" />
<param name="port" value="587" />
<param name="EnableSsl" value="true" />
<param name="Authentication" value="Basic" />
<param name="username" value="you@gmail.com" />
<param name="password" value="yourpassword" />
<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" />
<!--Defined conversion pattern for the output. To be able to output custom properties in the log (example, Taskname), append %property{propertyname} to the output pattern-->
</layout>
</appender>
<!--Send mail on task failure-->
<logger name="System.Scheduler.Scheduler.Slave.Tasks.ReloadTask">
<!--Logger name identifies the component to monitor. This can be found by investigating the actual log file-->
<appender-ref ref="MailAppender" />
<!--appender-ref should match the name identifying the appender. More than one appender can be configured in the same configuration file-->
</logger>
</configuration>
Very cool! Was wondering if it is possible to put the Task Name in the subject of the email? Was also wondering if it is possible to attach the actual log of the task that failed to the email?
I am able to get it working and it running fine for us. But I notices when new task starts in QMC and if retries to find a slave scheduler - this script sends an failure email. Task never fails, after retry it finds a slave scheduler and finishes fine. Is there any script needs to be added or modifies to ignore retry as a task failure.
This solution works perfectly fine when I try with one email id of client's domain in TO param and another 2 email ids of our domain in CC param.
But if I try to add more email ids in TO and CC, it does not seem working.
Has anyone experienced this before?.
Or is there some restrictions on the email ids that can be set up in TO and CC?