fluentd forwarding to elasticsearch
395
Docker containers log to elsticsearch using fluentd
td-agent to rootSet up td-agent.conf.
$ docker run -d \
--name fluentd-es \
-v [the path for td-agent.conf]:/etc/td-agent/td-agent.conf:ro \
ermaker/fluentd-es
For logging docker logs,
Set up td-agent.conf like this:
<source>
type tail
format json
time_key time
path /var/lib/docker/containers/*/*-json.log
pos_file /var/lib/docker/containers/containers.log.pos
time_format %Y-%m-%dT%H:%M:%S
tag docker.*
</source>
...
<match docker.**>
type elasticsearch
include_tag_key true
hosts es:9200
logstash_format true
logstash_prefix docker
# buffer
buffer_type file
buffer_path /var/lib/docker/fluentd/buffer/container.*.buffer
buffer_chunk_limit 8m
buffer_queue_limit 10000
retry_limit 17
flush_interval 5
</match>
$ docker run -d \
--name fluentd-es \
-v [the path for td-agent.conf]:/etc/td-agent/td-agent.conf:ro \
-v /var/lib/docker:/var/lib/docker \
ermaker/fluentd-es
Content type
Image
Digest
sha256:81c442e44…
Size
180.3 MB
Last updated
almost 11 years ago
docker pull ermaker/fluentd-es