Ysera
Assistant Engineer
Assistant Engineer
  • UID634
  • Fans0
  • Follows0
  • Posts44
Reads:1816Replies:0

[Share]Realizing docker log automation based on Logspout+ELK

Created#
More Posted time:Oct 9, 2016 14:56 PM
Logspout is a tool for collecting Docker container logs. It is connected to all host containers, and routed anywhere you want. It also has an expandable module system. It now captures STDOUT and STDERR.
If your needs are
1. All application log outputs are STDOUT and STDERR;
2. Container startup doesn't use -t.
We can automatically collect container logs utilizing Logspout + ELK.


It is demonstrated in the container service:
Create applications using the compose method. Now the image production has been completed and put into Alibaba Cloud HUB for direct use, saving the image production time. Therefore, it actually involves only one step of application creation in actual usage.
logbox:
  image: registry.aliyuncs.com/heizi/logbox
  ports:
    - '5000:5000/udp'
    - '9200:9200'
  restart: always
  hostname: logbox
kibanabox:
  image: registry.aliyuncs.com/heizi/kibanabox
  command: ["http://logbox:9200"]
  links:
    - logbox
  ports:
    - '5601:5601'
  hostname: kibanabox
  restart: always
logspout:
  image: registry.aliyuncs.com/heizi/logspout
  hostname: logspout
  labels:
    aliyun.global: true
  links:
    - logbox
  restart: always
  ports:
    - '8100:8000'
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock
  command: ["syslog://logbox:5000"]


After the application is started, the log is available in the Kibana console
Guest