ooni / sysadmin

System administration tools
https://ooni.org
59 stars 26 forks source link

Add journald logging for API #434

Closed FedericoCeratto closed 4 years ago

FedericoCeratto commented 4 years ago

helps with #433

FedericoCeratto commented 4 years ago
sudo journalctl -f CONTAINER_NAME=oomsm-web

The following key-value pairs are set:

    CONTAINER_NAME=oomsm-web
    CONTAINER_TAG=api-20200309-b63f75ac
    IMAGE_NAME=openobservatory/api:20200309-b63f75ac

Example truncated output:

Mar 16 12:55:07 ams-api.ooni.nu api-20200309-b63f75ac[10997]: server closed the connection unexpectedly
Mar 16 12:55:07 ams-api.ooni.nu api-20200309-b63f75ac[10997]:         This probably means the server terminated abnormally
Mar 16 12:55:07 ams-api.ooni.nu api-20200309-b63f75ac[10997]:         before or while processing the request.
Mar 16 12:55:07 ams-api.ooni.nu api-20200309-b63f75ac[10997]:  [SQL: 'SELECT coalesce ...
FedericoCeratto commented 4 years ago

nginx / gunicorn / api are simply logging (inconsistently) to stdout and docker is just dumping the logs into journald on the base host. e.g. we cannot filter by PID, process name, priority