KBEC-00051 - Attaching a log file to an email notifier

Article ID:360032832152
1 minute readKnowledge base
On this page

Summary

In Commander release 3.10 and after, notifier attachments are supported through the API and in the GUI. See the On Line Help for the details.

Previous to release 3.10 implement notifiers with alternatives methods that provide similar functionality.

Solution

Using properties to store file data

  1. Store the log file of interest as the value of a property:

  2. Reference the property inside a notifier template. When the notifier is run, the property will be expanded. There are two options for getting the file name:

    1. Use the Perl API to look for a field in the output of the getJobDetails command.

    2. Define your own log file name in the step. Be aware that you will have to define a property naming scheme that guarantees log file names are unique. For example:

      1. Using $[jobStepId] will make the name unique

      2. Using $[stepName] will make the name easier to understand

    3. Possible property names could be of the form $[stepName]-$[jobStepId]

  3. This approach provides a whole log file as the body of the email. Be aware that might make quite large emails.

Common sources of property data.

  1. Step log files

  2. Report generators such as ecreport

  3. Postprocessors can create properties of filtered output (see the "Postprocessors" topic in the ElectricCommander online help system for more details). You can use:

    1. Filtered Output - Postp provides a set of pre-defined filters for log files or you can define your own filters.

    2. Diagnostics - Diagnostic functionality allows you to extract a group of contiguous lines from the log file.