Hi,
I would like some input on how to do logging when running batch jobs. We need frequent log updates from the jobs as well as persisting the log. We are currently using Cloudwatch Logs and would like to keep doing so if possible.
I see that the "Log Shipper Pattern" is recommended in the docs, but I don't understand how that would work for batch jobs as there is no way for the log task to know when the main task has completed. I understand that this would work just fine for long running services, but not for batch jobs.
We have discussed a few solutions:
1. Reading the logs from the clients. We don't want to talk to the clients (I know a proxy feature is being worked on). It will also be a bit tricky to persist the logs.
2. Piping the output from the command to a script that uploads the logs "command | upload-logs". I haven't found how to do piping in Nomad, so maybe it's not even an option?
3. Running the script that uploads the logs directly and send the actual command as argument "run-command-and-upload-logs command".
I don't really like any of the solutions. Wouldn't it be possible for Nomad to handle the logging? Various logging services could be supported, which would be configured in the jobspec. This might be a bad idea for some reason and you are welcome to shoot it down.
Would sure appreciate your thoughts on this!
Thanks!