Assistant Engineer
Assistant Engineer
  • UID634
  • Fans0
  • Follows0
  • Posts44

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

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.
  image: registry.aliyuncs.com/heizi/logbox
    - '5000:5000/udp'
    - '9200:9200'
  restart: always
  hostname: logbox
  image: registry.aliyuncs.com/heizi/kibanabox
  command: ["http://logbox:9200"]
    - logbox
    - '5601:5601'
  hostname: kibanabox
  restart: always
  image: registry.aliyuncs.com/heizi/logspout
  hostname: logspout
    aliyun.global: true
    - logbox
  restart: always
    - '8100:8000'
    - /var/run/docker.sock:/tmp/docker.sock
  command: ["syslog://logbox:5000"]

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