Solved

How do I send a log file as an email attachment in FME Sever Automations?

  • 17 February 2020
  • 12 replies
  • 124 views

Badge +1

Hi,

I am using Automations in FME Server 2019.1 for the first time and I want to add the log file as an attachment to an email.

I have tried inputting the following two options into the Emailer but neither worked.

Option 1:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/*/{job id}.log

 

 

Option 2:

{job.log}

 

Automation Workflow:

As a side note, I would also like to know if it is possible to send multiple attachments with the Emailer in Automations? If so, what would the syntax be for that?

Thanks in advance!

icon

Best answer by sipsysigh 18 February 2020, 09:54

View original

12 replies

Badge +14

What are you trying to do with the job log? I have a workspace that I can share that we parse the log and send an email.

Badge +14

Take a look at this: https://github.com/runneals/GISProjects/blob/master/fme/FME%20Server%20Tools/fme_error_handling.fmw

Badge

Hi @aquamarine,

In the Automation, you will need to select Workspace | Job Log from the Upstream Messages dropdown under Email Attachment.

Notice the little 'Link' symbol circled above.

This should correctly attach the log file to the email.

Hope this helps,

Simon

Badge +1

What are you trying to do with the job log? I have a workspace that I can share that we parse the log and send an email.

Hi @runneals I am trying to send the job log as an attachment in an email after the job has completed.

Badge +1

Hi @aquamarine,

In the Automation, you will need to select Workspace | Job Log from the Upstream Messages dropdown under Email Attachment.

Notice the little 'Link' symbol circled above.

This should correctly attach the log file to the email.

Hope this helps,

Simon

Hi Simon,

Ok great thanks for that! I didn't realize you could click on the 'Workspace' item in the drop down!

It's all working as hoped now :)

 

Badge +2

Hi @aquamarine,

Just a quick update to let you know for Option 1, this wasn't working because the {job.id} key simply returns the job number, however the filename has the 'job_' prefix therefore the full name is job_{job.id}. Second it looks like we cannot process the wildcard, therefore the complete filepath actually needs to be:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job id}.log

For Option 2, I would expect this to work, as the Job Log value is the same whether you reference it via the Text Editor or directly through the drop down options, therefore I have filed bug FMESERVER-14393 to see if this can be fixed.

 

UPDATE: FMESERVER-14393 has been fixed. You can now specify {job.log} through the Text Editor as opposed to selecting the log from the drop down picker and it will work as expected. This was fixed for FME 2020.0 which is available for download now from safe.com/downloads
Badge

Hi @aquamarine,

Just a quick update to let you know for Option 1, this wasn't working because the {job.id} key simply returns the job number, however the filename has the 'job_' prefix therefore the full name is job_{job.id}. Second it looks like we cannot process the wildcard, therefore the complete filepath actually needs to be:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job id}.log

For Option 2, I would expect this to work, as the Job Log value is the same whether you reference it via the Text Editor or directly through the drop down options, therefore I have filed bug FMESERVER-14393 to see if this can be fixed.

 

UPDATE: FMESERVER-14393 has been fixed. You can now specify {job.log} through the Text Editor as opposed to selecting the log from the drop down picker and it will work as expected. This was fixed for FME 2020.0 which is available for download now from safe.com/downloads

Hi @hollyatsafe,

I followed option 1 to attache the logfile but then I don't receive any mail. When I specify the log ID I receive a mail, but that is not what I want...the logfile has to fit the job that triggers the notification, not a specified (old) job.

 

We use:

 

receiving no mail:

 

receiving a mail, but whit the specified job ID:

 

what did I do wrong?

Badge

Hi @hollyatsafe,

I followed option 1 to attache the logfile but then I don't receive any mail. When I specify the log ID I receive a mail, but that is not what I want...the logfile has to fit the job that triggers the notification, not a specified (old) job.

 

We use:

 

receiving no mail:

 

receiving a mail, but whit the specified job ID:

 

what did I do wrong?

Hi @dannymeus,

It looks like a typo in the Email Attachment path. It should be:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}

Thanks,

Simon

Badge

Hi @aquamarine,

Just a quick update to let you know for Option 1, this wasn't working because the {job.id} key simply returns the job number, however the filename has the 'job_' prefix therefore the full name is job_{job.id}. Second it looks like we cannot process the wildcard, therefore the complete filepath actually needs to be:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job id}.log

For Option 2, I would expect this to work, as the Job Log value is the same whether you reference it via the Text Editor or directly through the drop down options, therefore I have filed bug FMESERVER-14393 to see if this can be fixed.

 

UPDATE: FMESERVER-14393 has been fixed. You can now specify {job.log} through the Text Editor as opposed to selecting the log from the drop down picker and it will work as expected. This was fixed for FME 2020.0 which is available for download now from safe.com/downloads

Hi @hollyatsafe,

With regard to the comment left by @dannymeus above, could you update the file path to the server log file in you answer to:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}

Thanks,

Simon

Badge

Hi @hollyatsafe,

With regard to the comment left by @dannymeus above, could you update the file path to the server log file in you answer to:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}

Thanks,

Simon

Hey @sipsysigh,

thank you for your reaction. I see I was not complete in my previous question. At that moment I also tried other file path's like:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job id}.log

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/{job id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}.log

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/{job.id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{id}.log

 

 

all without success.....

 

when i use the {id} in de 'email subject' and send it without an attachment, it gives me an email with the job ID number in the email subjectfield.....that works fine, but not in the attachment file path....

 

 

so this is not the solution yet to send the current log file as an attachment....

Badge +2

Hey @sipsysigh,

thank you for your reaction. I see I was not complete in my previous question. At that moment I also tried other file path's like:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job id}.log

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/{job id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}.log

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/{job.id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{id}

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{id}.log

 

 

all without success.....

 

when i use the {id} in de 'email subject' and send it without an attachment, it gives me an email with the job ID number in the email subjectfield.....that works fine, but not in the attachment file path....

 

 

so this is not the solution yet to send the current log file as an attachment....

Hi @dannymeus,

From the images attached it looks like you are setting up an Email Subscription, therefore the file path I shared will not work for you as the job_id keyword is for Automations.

For Notifications the list of available key words can be found here. After doing some testing with Notifications it looks like the Attachment parameter is not able to resolve keywords and therefore the Email Subscriber does not support including the log file as an attachment.

Since you are on 2019.2 Automations is available to you, so I would recommend using this an alternative to configure your email to include this attachment. Then you can use the 'Best Answer' on this thread and specify the Job Log keyword instead of having to type out the full file path.

Badge +2

Hi @hollyatsafe,

With regard to the comment left by @dannymeus above, could you update the file path to the server log file in you answer to:

$(FME_SHAREDRESOURCE_LOG)/engine/current/jobs/0/job_{job.id}

Thanks,

Simon

Hi @sipsysigh,

Please could you clarify what needs changing in my original post, the {job_id} keyword will only set the job ID number, so you would still need to set the .log extension in the filepath if you were going to attach the job file in this way.

Reply