Solved

Adding Errors and Warnings from Automation Log File to Email (External Action)

  • 26 March 2024
  • 4 replies
  • 41 views

Userlevel 1
Badge +15

Is there a way to include the errors and warnings in an Automation’s log file in an email (external action)? Which Key would this be, or do I need to create a global key that would include this information?

icon

Best answer by kate-safe 27 March 2024, 16:45

View original

4 replies

Userlevel 1
Badge +4

Hi @vxn43 

Thank you for your post!

The best way to do this is to attach the job log to the email.  To do this, on the Email external action you will want to click the dropdown arrow next to “Email Attachment” and select Workspace | Job Log. You can use this same process for both failure or success ports as needed.

If you are just wanting to include the specific warnings/errors in the body of the email instead (or as a separate document), then you will need to develop a second workspace that can parse the log file for warnings/errors to then compile those in a separate document that you could then include. 

I hope this helps clarify things!

Kate

Userlevel 1
Badge +15

So it can be accessed in an FME Form workspace, what is the best way to identify the path to the location of the log file generated by the Automation? in other words, how would I go about gaining access to the job log that would allow me add it into a workbench?

Userlevel 1
Badge +15

In my Automation, I was able to obtain the path to the log file in FME Flow by adding the the job log key to the email (external action) subject.

$(FME_SHAREDRESOURCE_LOG)engine\current\jobs\xxxx\job_757232.log

This gets me to the actual log file. I can also attach this log file to the email which provides a text file of the log. 

In FME Form, found the FMEServerLogFileRetriever Transformer. 

Here is what I would like to do:

  1. The Automation is run and creates a Job ID.
  2. I take this Job ID and add it into the FMEServerLogFileRetriever Transformer and parse out the Warnings/Errors and send these in the Emailer Transformer. 
  3. This new workbench will be uploaded to FME Flow and run in an Automation that will send me an email if there are any Warnings/Errors and include these in the email body.

 

Question:

In the Automation, the Job ID is created after the job is run. This means I can only obtain the Job ID by going into FME Flow - Jobs - Completed and manually copy and paste the Job ID into the FMEServerLogFileRetriever. This gets me what I need, but is there a way to automatically add the Job ID to this Transformer so I do not have to manually copy and paste it into the workspace then save the workspace and republish it to FME Flow? If there is a way to automatically extract the Job ID associated with a specific Automation, then I can run a new workspace in an Automation that will send me the email with the warnings/errors. To achieve this I would need to know the Job ID beforehand, is this even possible?

Also, each time the Automation is run it generate a different Job ID. 

Badge +2

Hi @vxn43 !

When you use a Run Workspace action in an automation, one of the Output Attributes is the job ID. 

This attribute can be fed into a subsequent Run Workspace action as a parameter. 

This way the automation will feed the different job id to the next workspace each time it runs. Hopefully that makes sense!

-Bailey 

Reply