Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download docker logs from remote server

Tags:

docker

logging

How can I download docker logs from remote server easily ? I can pipe the logs to a file and then use scp to download the file, but it's a bit cumbersome.

like image 871
Quan Vuong Avatar asked Mar 26 '17 16:03

Quan Vuong


People also ask

How do I download docker container logs?

Do direct scp from the remote system. Use some log monitoring tools like Graylog or ELK so that you can stream your live container logs in browser. Use Container orchestration tool like kubernetes which shows all container logs in its console itself even if multiple remote nodes are present.

How do I get full docker logs?

First of all, to list all running containers, use the docker ps command. Then, with the docker logs command you can list the logs for a particular container. Most of the time you'll end up tailing these logs in real time, or checking the last few logs lines.

Where are docker container logs stored?

By default, the Docker containers log files are stored in /var/lib/docker/containers/<containerId> dir.


1 Answers

Depends what you're trying to do.

If you're just trying to ship the logs off somewhere else for storage/auditing purpose, maybe consider a different logging driver like the syslog or splunk drivers.

However, if you just want to copy them locally for debugging purposes, the json-file driver will store the files in /var/lib/docker/containers/<container-id>/<container-id>-json.log

You can simply scp that file down and get all the logs you need.

like image 115
jaxxstorm Avatar answered Oct 19 '22 00:10

jaxxstorm