Best way to capture logs from worker processes?


#1

Hi there,

We have a couple of worker processes running (RabbitMQ consumers). How might we get a log drain from them?

Thanks!
Logan


#2

Hi there,

There are two ways to do this:

  • You can use the Aptible CLI, with aptible logs --app $APP_HANDLE. This will stream the logs from your app in real-time to your terminal.
  • You can create a new Log Drain from the “Logging” tab in the Dashboard. You’ll have to send those logs somewhere, of course. The two main options are using a supported logging provider (anything that can accept logs via syslog over tls should work, so that includes e.g. Papertrail and Logentries), or set up an Elasticsearch + Kibana on Aptible to access your logs.

There’s more information here if you’d like.

Let me know if you have any questions!


#3

Hey Thomas,

Thanks for the response! So both of these options will just combine all logging output from any service in the app (ie, the web service and a couple of other distinct worker services running in different containers)?

Logan


#4

Yes, that’s correct: all logging output will be captured. In all cases, there is metadata on the log records showing which service they’re coming from, though:

  • Using the Aptible CLI or a Syslog Log Drain, the service is shown as a prefix.
  • Using an Elasticsearch or HTTPS Log Drain, the service is provided as a service attribute on log records (the log record itself is found in the log attribute).

Cheers,