By default Docker keeps container logs in its own JSON files, separate from everything else on the machine. On a plain Debian or Ubuntu server I like having them in the systemd journal instead, next to the logs of the host. Docker’s journald log driver does that, and every line comes with fields you can filter on.
Set the driver for all new containers in /etc/docker/daemon.json and restart Docker, or give one container --log-driver=journald on docker run. Each line then carries CONTAINER_NAME, CONTAINER_ID, IMAGE_NAME and CONTAINER_TAG, and journalctl matches on those like on any other field:
# /etc/docker/daemon.json
{
"log-driver": "journald"
}
sudo journalctl -b CONTAINER_NAME=webserver
sudo journalctl -o json CONTAINER_NAME=webserver
The first command shows what the webserver container printed since the last boot, the second gives the same lines as JSON with every field attached, so you can see which image and container ID they came from. The usual journalctl options such as -f and --since work on top. docker logs keeps working with this driver too.
A few catches. The daemon setting only applies to containers created after the restart, so recreate the ones you want to move. CONTAINER_NAME is the name at the time the container started; after a docker rename the journal keeps using the old one. If a container runs with a TTY you may see [10B blob data] instead of text, and adding --all shows it. And the logs now share the journal’s size limits, so a chatty container can push out older host logs.
Further reading: Journald logging driver (Docker docs), journalctl(1) manual page