/logspout-fluentd

Logspout module for logging to fluentd.

Primary LanguageGo

logspout-fluentd

Logspout module for forwarding Docker logs to fluentd. Custom Docker log fiels:

  • ident: docker-container-log
  • docker/image
  • docker/id
  • docker/name (or env variable MESOS_TASK_ID/mesos_task_id for mesos/chronos/marathon containers)

Usage

This module works by acting as a fluentd forwarder, sending messages with a tag name docker.{Hostname}, where {Hostname} is the .

Configure Logspout to receive forwarded messages, something like this:

<source>
  type forward
  port 24224
  bind 0.0.0.0
</source>

<match docker.**>
  # Handle messages here.
</match>

Compilation

git clone https://github.com/gliderlabs/logspout
# add into modules.go:
_ "github.com/Trufa-me/logspout-fluentd"
docker build --rm -t mycustomlogspout .
docker run \
  --name=mycustomlogspout \
  --hostname=myhostname -d \
  -v /var/run/docker.sock:/var/run/docker.sock \
  mycustomlogspout \
  fluentd://<fluentd_ip>:24284