使用Graylog2收集Docker日志
2017-08-09 00:00
423 查看
To find the current default logging driver for the Docker daemon, run docker info and search for Logging Driver. You can use the following command on Linux, macOS, or PowerShell on Windows:
-- https://docs.docker.com/engine/admin/logging/gelf/
-- https://docs.docker.com/engine/admin/logging/overview/
To use the
To use
To make the configuration permanent, you can configure it in
You can set the logging driver for a specific container by setting the
You can try with this working example yaml:
-- https://docs.docker.com/engine/admin/logging/gelf/
-- https://docs.docker.com/engine/admin/logging/overview/
To use the
gelfdriver as the default logging driver, set the
log-driverand
log-optkeys to appropriate values in the
daemon.jsonfile, which is located in
/etc/docker/on Linux hosts
To use
gelfas the default logging driver for new containers, pass the
--log-driverand
--log-optoptions to the Docker daemon:
dockerd -–log-driver gelf –-log-opt gelf-address=udp://1.2.3.4:12201 \
To make the configuration permanent, you can configure it in
/etc/docker/daemon.json:
{ "log-driver": "gelf", "log-opts": { "gelf-address": "udp://1.2.3.4:12201" "tag": "container" } }
You can set the logging driver for a specific container by setting the
--log-driverflag when using
docker createor
docker run:
$ docker run \ -–log-driver gelf –-log-opt gelf-address=udp://1.2.3.4:12201 \ alpine echo hello world
You can try with this working example yaml:
example: container_name: example image: debian:wheezy command: /bin/sh -c "while true; do date && echo "hello"; sleep 1; done" ports: - "1234:1234" log_driver: "gelf" log_opt: gelf-address: "udp://graylog.example.com:12201" gelf-tag: "first-logs"
相关文章推荐
- 日志收集平台Graylog2以及Nxlog的安装与配置(基于docker)
- 使用Docker构建ELK Docker集群日志收集系统
- dcos - docker的日志收集
- 使用rsync归档收集Tomcat日志
- 日志收集框架 Flume 组件之Source使用
- 分布式数据日志收集之Flume的安装和使用
- 使用Logstash收集MongoDB日志并通过Zabbix报警
- 使用flume进行日志收集的总结(2)
- 使用kibana+logstash+elasticsearch+redis搭建分布式日志收集、分析、查询系统。
- Flume+Kafka收集Docker容器内分布式日志应用实践
- 使用Logstash收集Nginx日志
- Java日志框架使用技巧收集(slf4j、jcl、jul、log4j1、log4j2、logback)
- 使用Fluentd和MongoDB构建日志收集系统
- 使用logstash收集日志的可靠性验证
- nginx日志切割并使用flume-ng收集日志
- 使用开源软件sentry来收集日志
- 使用Fluentd + MongoDB构建实时日志收集系统
- 使用rsyslog+loganalzey收集日志显示客户端ip
- 结合Docker快速搭建ELK日志收集分析平台
- Docker容器内应用的日志收集方案