Troubleshooting

Let’s learn to troubleshoot a swarm service using its logs.

docker service logs

Swarm Service logs can be viewed with the docker service logs command. However, not all logging drivers support the command.

By default, Docker nodes configure services to use the json-file log driver, but other drivers exist, including:

  • journald (only works on Linux hosts running systemd)
  • syslog
  • splunk
  • gelf

json-file and journald are the easiest to configure, and both work with the docker service logs command. The format of the command is docker service logs <service-name>.

If you’re using 3rd-party logging drivers you should view those logs using the logging platform’s native tools.

The following snippet from a daemon.json configuration file shows a Docker host configured to use syslog.

Get hands-on with 1200+ tech skills courses.