Docker and Fluentd (revised)

21
Docker and Fluentd 2015/06/04 Golang & Docker users meetup Satoshi Tagomori (@tagomoris)

Transcript of Docker and Fluentd (revised)

Page 1: Docker and Fluentd (revised)

Docker and Fluentd

2015/06/04 Golang & Docker users meetup Satoshi Tagomori (@tagomoris)

Page 2: Docker and Fluentd (revised)

@tagomorisTreasure Data, Inc.

Fluentd, Norikra, Hadoop, ...

Page 3: Docker and Fluentd (revised)
Page 4: Docker and Fluentd (revised)

Which more cute than another?

Page 5: Docker and Fluentd (revised)

Logging of container architecture

Storage:> should be outside of container / hosts

Transferring:> should be over network

Aggregation:> should be done per container / per service

Page 6: Docker and Fluentd (revised)

Container-based worldneeds unified logging layer!

Page 7: Docker and Fluentd (revised)

Structured logging

Reliable forwarding

Pluggable architecture

http://fluentd.org/

Page 8: Docker and Fluentd (revised)
Page 9: Docker and Fluentd (revised)

What’s Fluentd?

> Data collector for unified logging layer> Streaming data transfer based on JSON> Written in Ruby

> Gem based various plugins> http://www.fluentd.org/plugins

> Working in production> http://www.fluentd.org/testimonials

Page 10: Docker and Fluentd (revised)

Architecture

EngineInput

Filter Output

Buffer

> grep > record_transfomer> …

> Forward> File tail> ...

> Forward> File> ...

Output

> File> Memory

not pluggable

FormatterParser

Page 11: Docker and Fluentd (revised)

Aggregation Patterns

(1) 1-level aggregation (2) 2-level aggregation

Page 12: Docker and Fluentd (revised)

Aggregation Patterns

(1) 1-level aggregation (2) 2-level aggregation

pros:simple configuration

cons:fixed aggr. addressmany connectionshigh load for aggregator

pros:less connectionslower load for aggr.

cons:a bit more container

Page 13: Docker and Fluentd (revised)

Aggregation Patterns

(1) 1-level aggregation (2) 2-level aggregation

Apps sends logs over fluent-logger

there're some patterns...

or ...

Page 14: Docker and Fluentd (revised)

Pattern of 2-level aggr. w/ Fluentd

1. Network transferring

2. Container log & tail

Page 15: Docker and Fluentd (revised)

(1) Network transferring

Apps sends logs:> using fluent-logger-*> over inter-container network

Pros:> no performance penalty

Cons:> logs of docker is out of scope> a bit complex apps for logging

over TCP

app

Page 16: Docker and Fluentd (revised)

(2) Container logger & tail

Apps write logs to STDOUT:> docker writes it to log file> fluentd container reads file

Pros:> simple conf for apps & docker> logs include container logs

Cons:> in_tail performance penalty

log file

app

http://www.fluentd.org/guides/recipes/docker-logging

Page 17: Docker and Fluentd (revised)
Page 18: Docker and Fluentd (revised)

Logging drivers

New from docker v1.6!

'Add new Logging driver "fluentd"'> --log-driver=fluentd

> https://github.com/docker/docker/pull/12876

> New for docker v1.7.0?

Page 19: Docker and Fluentd (revised)

over TCP

(3) Container logging driver "fluentd"

Apps write logs to STDOUT:> docker send it to fluentd

directly!

Pros:> simple conf for apps & docker> logs include container logs

Cons:> none?

app

Stay tune!

Page 20: Docker and Fluentd (revised)

Fluentd docker image

Official image by fluent organizationhttps://registry.hub.docker.com/u/fluent/fluentd/

Use it as it is, or build your own container!https://github.com/fluent/fluentd-docker-image

Page 21: Docker and Fluentd (revised)