by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

Docker has a lot of built-in log mechanisms to help us obtain service information executed in the container.
These mechanisms (mechanisms) we usually call logging drivers.

If you want to change the default logging drivers (logging drivers), you can set the name of the login-driver program in the daemon.json file. This file is usually placed in the /etc/docker directory of the linux system, or C:\ProgramData\docker\config\ on Windows
The default logging driver of Docker is json-file, change it to syslog.


On MacOS system, it can be set by Docker preferences:
daemon.json
After restarting, you will find that the log records have changed to syslog.


For more configuration settings of Docker Deamon, you can refer to the official link:
https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file

Use the command to query the default Logging Driver.
docker info |grep Logging

Below is a list of supported Loggin drivers:
driver Description
none No logs will be available for the container and docker logs will not return any output.
json-file The logs are formatted as JSON. The default logging driver for Docker.
syslog Writes logging messages to the syslog facility. The syslog daemon must be running on the host machine.
journald Writes log messages to journald . The journald daemon must be running on the host machine.
gelf Writes log messages to a Graylog Extended Log Format (GELF) endpoint such as Graylog or Logstash.
fluentd Writes log messages to fluentd (forward input). The fluentd daemon must be running on the host machine.
awslogs Writes log messages to Amazon CloudWatch Logs.
splunk Writes log messages to splunk using the HTTP Event Collector.
etwlogs Writes log messages as Event Tracing for Windows (ETW) events. Only available on Windows platforms.
gcplogs Writes log messages to Google Cloud Platform (GCP) Logging.
logentries Writes log messages to Rapid7 Logentries.

When I create a container with the docker run command,
Or when docker-compose starts, specify the logging driver to use.
For example, the dokcer on my Synolog Nas, Mo Ming ran a strange logging driver called db. (The following figure)


I want to execute json-file when my docker-compose starts.
you can make up
loggin:
driver: json-file

 

Tags: docker

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


wordpress, d-laravel, docker, docker-compose

How to install Wordpress with D-Laravel

An 8-minute teaching video, introducing the installation of Wordpress on D-Laravel. D-Laravel is a docker-compose Laravel framework development environment, but it does not mean that it cannot be used to install other things. This video introduces the use of D-Laravel to install non-Laravel PHP projects, You can learn the usage of related instructions on D-Laravel: ./create --host usage, docker-compose up -d and ./console mysql usage, The database connection setting method after D-Laravel v1.0.0.

docker,polymer,seo

Solving Polymer SEO Problems with Rendertron (Polymer Summit 2017)

The video below the article introduces how to use rendertron to solve Polymer SEO optimization problems. In the source of my fork, it has been adjusted to support the Chinese environment. And also added the API interface of pdf, which can also be used to convert pdf.

docker

Install docker-compose on ubuntu

Briefly introduce how I installed docker-compose on ubuntu. Quite easy.