We'd like to get Loki to not only aggregate the system logs, but also the logs our services are generating. We could adjust the Promtail configuration to look for the logs wherever they're stored by Docker, but they could be tricky to find and the container may not sync them with the filesystem in a timely enough fashion.
Luckily, the folks at Grafana have provided a log driver for Docker that can deliver logs to Loki directly, thus bypassing Promtail entirely. It requires downloading a special Loki log driver and requires adjusting the docker-compose.yml file so that it includes the new logging information. To download and install the driver, run the following command:
% docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
To confirm the installation, run the following command:
% docker plugin ls
ID NAME DESCRIPTION ENABLED
692bec0b6ade loki...