Any way to email console log of jobs that fail?

I’m looking to have Concourse email me the full console log (the log that shows in the Concourse UI) as a text file when a job fails. Is that possible?

Basically console log comes from three sources:

  • resource get
  • resource put
  • task

For resource get/put, stderr go to console log, and stdout go to console as output of get/put. For task, stdout just go to console.

To email something, you will need to use some resource type of email. From a resource type, only way to get artifacts from previous resource and task is via files. For resource get/put, I don’t see a way to pass its stderr to a following resource. For task, you may redirect output to both stdout and a file vai tee, so that a following email resource type get task output from the file.

I guess this just partially solve your problem. I’m also wondering a better solution.

I think that @evanchaoli gave a good overview of the situation (use tee and email).

Another little known feature of Concourse is that it can stream build logs to syslog (and so for example could be a remote syslog, or syslog could be watched with tools like
See for how to configure the ATC to stream to syslog.