Obtain log file and send it via email

Hello to everyone,
I need your help to solve this problem that I have, I will describe my scenario:
I have a master job and a lot of subjobs inside him, in all levels I am using a tJava to print into a Log file using the function:
-System.out.println("The name of the job Started/Ended, etc.")
When the deployment ends this log file is generated and I need to download it from the TAC to my computer (JobConductor --> Select the executed job --> Show Monitoring Grid --> Go to the page one of the Monitoring Grid --> Download entire log option);
If I executed from the TAC a master job with subjobs inside him, every time that the tJava ended will write into the same log file, if I executed only one of the child jobs, it will write into the log file without the information of the high level;
Now, I need to obtain the log file to send it via email (using a tSendMail component) every time a subjob ends, I know that I need to take it from the TAC server using a FTP, pasting into the Talend repository and take it from there with the tSendMail component like an attachment, the problem is that I noticed that the TAC using a different variables to named the log file and the path.
I need to capture the variables that the TAC uses to write the log path and name like the taskId, jobId, JobExecutionId, etc. in Talend Studio.
The name of the path looks like this:
/u01/talend/Tac/Logs/task_26/1404879029355_task_26_logs/
And the log file like this:
OUT_ERR_EXEC_20140708231256_oZpdp.log"
I noticed that the Data Base of the TAC uses the table taskexecutionhistory to preserve some history of the logs, so I think that I can make a connection from the Talend Studio to this Database and make a match with the idquartzjob or the idremotejobexecution to obtain the name of the log, but first I need to capture this variables from the Talend Studio,
I am open to suggestions, recomendations or more questions about this topic.
I hope you can help me.
Thank you for your time and considertion.
Regards.
8 REPLIES
Moderator

Re: Obtain log file and send it via email

Hi contreras,
Would you mind uploading your job design screenshots into forum so that we can get your current situation more precisely.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

Re: Obtain log file and send it via email

Hello Sabrina,
thank you for your response,
I will put 3 images:
-the first shows how I am using tJava's for write into the log file;
-the second one shows how I'm obtaining at this moment the Log file from the TAC;
-and the third one shows how I'm trying to obtain the variables to get the log file and send it via email with the tSendMail from a Job before the master Job ends.
I am having problems with the last point because when the FTP search the log file into the TAC server can't find it, maybe the log file it been created by the TAC server until all jobs have finished, I don't know yet.
Regards!
Moderator

Re: Obtain log file and send it via email

Hi econtreras,
 
Could you indicate the build version you are using?
Would you mind connecting to the Support portal and logging your request, so that we can give you a remote assistance with priority, through the support cycle.
 
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

Re: Obtain log file and send it via email

Hi Sabrina,
I´m using the versión:
---Version: 5.3.1
---Build id: r104014
I solved this topic, I use system variables to obtain the log name and the path of logs files at the execution server, I am attaching images to solve it.
Regards!
Moderator

Re: Obtain log file and send it via email

Hi,


 


Thanks for your feedback. Let us know is there any problem when you upload image into talend forum.


 


Best regards


Sabrina


             
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Obtain log file and send it via email

Hi,


 


Thanks for your feedback. Let us know is there any problem when you upload image into talend forum.


 


Best regards


Sabrina


             

Yes, let me try again to attach the images, I do not know why I can't attach the images yesterday.
Regards!
*I noticed that the web page have some problems while trying to log in.
Moderator

Re: Obtain log file and send it via email

Hi,
I noticed that the web page have some problems while trying to log in.

What's the problem you got? Can you login to talend forum using your user name and password? Are you able to upload your image by chicking "Upload" button or dropping your file into "Drop files here to attache them" field directly?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Obtain log file and send it via email

Can someone provide the solution for this?