Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Sending error messages by Email

  1. #1
    Join Date
    May 2011
    Posts
    23

    Default Sending error messages by Email

    I am using Kettle 4.1. I have a JOB that executes things like file tests, transformations, zipping and deleting files etc. I'd like to have all steps in the job send an email on failure.

    Since Kettle 4 there are no log files anymore (correct?), it is all stored in memory. From searching the web and from Matt's book 'Pentaho Kettle Solutions' I learned, that it is possible to add JavaScript code to read the errorlog of the previous step. So I created in my Job a JavaScript job with code as follows:

    Code:
    var errorMsg = previous_result.getLogText();
    parent_job.setVariable("ERR_MSG", errorMsg);
    
    true;
    So the 'follow when result is false' path of all steps point to this JavaScript. This is then followed by a Mail step which should send an Email with the content of the variable "ERR_MSG" in the message body.

    Can this be done?? I tried to put in the mail message a ${ERR_MSG} but that remains empty. Could anybody please give me a hint or a short example? I would really appreciate any help!

    Many thanks, Thomas

  2. #2
    Join Date
    Sep 2007
    Posts
    834

    Default

    you can do it, but... no log files anymore? That's not true.
    You configure the log file in the Job or Transformation entries, "Logging settings" tab.
    BTW this is explained in detail in Chapter 9, PDI cookbook

  3. #3
    Join Date
    May 2011
    Posts
    23

    Default

    Hi Maria,

    Looks like I do understand things completely wrong! My Job Properties doe hav a log tab but there you can only configure logging to a database!

    Unfortunately I only have the version 3.2 cookbook and there is nothing the like in Chapter 9!

    Thomas

  4. #4
    Join Date
    Sep 2007
    Posts
    834

    Default

    Thomas
    You're talking about Job / Transformation settings (the window that you can see and configure from the job / transformation itself). In those tabs you configure the database log; that's correct.
    I was talking about the log tab in the Job / Transformation job entries.

    Now I'm lost: which book is that? 3.2 cookbook? I know PDI 3.2 Beginners and PDI 4 Cookbook.

  5. #5
    Join Date
    Mar 2012
    Posts
    3

    Default

    Quote Originally Posted by tbednarz View Post
    I am using Kettle 4.1. I have a JOB that executes things like file tests, transformations, zipping and deleting files etc. I'd like to have all steps in the job send an email on failure.

    Since Kettle 4 there are no log files anymore (correct?), it is all stored in memory. From searching the web and from Matt's book 'Pentaho Kettle Solutions' I learned, that it is possible to add JavaScript code to read the errorlog of the previous step. So I created in my Job a JavaScript job with code as follows:

    Code:
    var errorMsg = previous_result.getLogText();
    parent_job.setVariable("ERR_MSG", errorMsg);
    
    true;
    So the 'follow when result is false' path of all steps point to this JavaScript. This is then followed by a Mail step which should send an Email with the content of the variable "ERR_MSG" in the message body.


    Can this be done?? I tried to put in the mail message a ${ERR_MSG} but that remains empty. Could anybody please give me a hint or a short example? I would really appreciate any help!

    Many thanks, Thomas


    Same thing to me ...Do you solve your problem ?

  6. #6

    Default

    also curious.. I have some sql scripts iside of a .kjb that go to an email step on error. I'd like them to either pick up the error message sent from the server, or ONLY have those error messages written to a file which the email could forward along... any way?

  7. #7
    Join Date
    Oct 2013
    Posts
    5

    Default

    me too, I am having the same sort of requirement as well, any solutions?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.