Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

Sending e-mail alerts in Qlik Sense Enterprise Task Failures

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Clever_Anjos
Employee
Employee

Sending e-mail alerts in Qlik Sense Enterprise Task Failures

Last Update:

Apr 26, 2018 7:31:47 PM

Updated By:

Clever_Anjos

Created date:

Apr 26, 2018 7:31:47 PM

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.

Capture.PNG


3 - Restarting your Scheduler Service


Check if any task is running before restarting the service!!

Capture.PNG



4 - Test

  • Create an app and create an very "silly always fail" script like Store notable into [lib://neverland/notable.qvd](qvd)
  • Schedule your app as usual (under QMC/Apps/[your app]/More options button/Create New Reload Task

    (https://help.qlik.com/en-US/sense/April2018/Subsystems/ManagementConsole/Content/create-reload-tasks...)

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


Comments
mike_rowe
Contributor III
Contributor III

Hi

 

This happened to me when I tried to do more than one email as:

email1@test.co.uk; email2@test.co.uk

But when i separated by a comma it works ok. Eg.

email1@test.co.uk, email2@test.co.uk

I did read an article about why it had to be like this but was quite a while ago and can't remember the reason for it needing to be like this.

 

Anyway hopefully this will work for you.

 

Mike

0 Likes
smadathil
Partner - Contributor II
Partner - Contributor II

Hi Mike,

        I separated email ids using comma only and it worked fine when I had one email id in TO (abc@domain1.com) and in CC, I had two email ids (cde@domain2.com, fge@domain2.com).

       But I had problem when I tried to add one more email id of domain1.com to TO and CC.

       Not able to understand the reason.

0 Likes
mike_rowe
Contributor III
Contributor III

Do you mean it didn't work when you had more than one email separated by a comma in both the To and CC parameters? But when you had just one in To parameter and two in CC parameter it worked ok?

0 Likes
smadathil
Partner - Contributor II
Partner - Contributor II

I meant that it worked fine when I had one in To parameter and two in CC parameter.

  But when I tried to make it two in TO and three in CC, it is not working.

0 Likes
mike_rowe
Contributor III
Contributor III

Hi

I've tested it on mine and it seems to be working fine. This is how I have written the code:

<param name="to" value="email1@wwl.nhs.uk,email2@wwl.nhs.uk,email3@wwl.nhs.uk,email4@wwl.nhs.uk" />

<param name="cc" value="email1@wwl.nhs.uk,email2@wwl.nhs.uk,email3@wwl.nhs.uk" />

 

Not sure what to suggest other than checking your code against mine.

Mike

morenoju
Partner - Specialist
Partner - Specialist

Guys, I've configured the xml as shown above and restarted the Scheduler Service, but when a task fail I don't see anything being sent. Do you know if this is supposed to work in Qlik Sense 3.2?

This is my xml in C:/ProgramData/Qlik/Sense/Scheduler/LocalLogConfig.xml

<?xml version="1.0"?>
<configuration>
<!-- Mail appender-->
<appender name="MailAppender" 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="mypersonal@account.com" />
<param name="from" value="email@gmail.com" />
<param name="subject" value="Qlik Sense Task Alert" />
<param name="smtpHost" value="smtp.gmail.com" />
<param name="port" value="587" /> <!-- 25, 465, 567 -->
<param name="EnableSsl" value="true" /> <!-- True False -->
<param name="Authentication" value="Basic" /> <!-- None Basic NTML -->
<param name="username" value="email@gmail.com" />
<param name="password" value="password" />
<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="The Task '%property{TaskName}' failed at %date with the Errorlevel '%-5level' %newline%newlineThe App Name is '%property{AppName}' %newline%newlineThe Message was '%message' %newline%newline%newline" />
</layout>
</appender>
<!--Send mail on task failure-->
<logger name="System.Scheduler.Scheduler.Slave.Tasks.ReloadTask">
<appender-ref ref="MailAppender" />
</logger>
</configuration>

0 Likes
VilmarLeite
Contributor
Contributor

Olá, infelizmente não estou conseguindo rodar esse procedimento.

<?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="@@@@@@" />
<param name="from" value="relatoriosqlikview@@@@@" />
<param name="subject" value="Qlik Sense" />
<param name="smtpHost" value="@@@@" />
<param name="port" value="25" />
<param name="EnableSsl" value="False" /> <!-- True False --> esse parametro tirei, coloquei 
<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>

 

a validação do é  Authentication  Method Anonymous

 

alguma sugestão?

obrigado!

 

 

Resolvido o problema, com o ambiente possui Nó, fiz a mesma configuração no outro server e funcionou!

obrigado!

0 Likes
cdyaro
Contributor II
Contributor II

Hi,

 

Can anyone please advise how to troubleshoot this?

I'm trying to figure it out why I'm not getting emails.

SMTP should working fine as tested via PowerShell basic script.

fzalexanderjohn
Creator
Creator

I Agree with @cdyaro 

For some reason it broke. Now troubleshooting it is very painful since there's apparently zero logs for it.

mgb
Contributor
Contributor

Can @Clever_Anjos tell us if this method is working in recent releases? There is any way to know what is wrong or why we aren't receiving emails?
It's very frustrating to loose time with this. It's a very basic feature that has to be ready out of the box in a simple way like Qlikview does.

Version history
Last update:
‎2018-04-26 07:31 PM
Updated by: