CenterForOpenScience/fluent-plugin-docker-format

Name: fluent-plugin-docker-format

Owner: Center for Open Science

Description: null

Forked from: bwalex/fluent-plugin-docker-format

Created: 2016-09-19 18:41:05.0

Updated: 2016-09-19 18:41:06.0

Pushed: 2016-04-06 04:58:43.0

Homepage: null

Size: 14

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Fluent::Plugin::Docker::Format

This fluentd output filter plugin can parse a docker container's config.json associated with a certain log entry and add information from config.json to the record.

Installation

Add this line to your application's Gemfile:

gem 'fluent-plugin-docker-format'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fluent-plugin-docker-format
Usage
ch docker.var.lib.docker.containers.*.*.log>
pe docker_format
cker_containers_path /var/lib/docker/containers
ntainer_id ${tag_parts[5]}
g docker.all
tch>

The docker_containers_path is optional and defaults to /var/lib/docker/containers.

The container_id parameter can either be a string with the id, or use the special interpolated substitution ${tag_parts[<some number>]}. The tag parts are the dot-separated parts of the incoming tag, so that in the above example they would match the first star.

A full example:

rce>
pe tail
th /var/lib/docker/containers/*/*-json.log
s_file /var/log/fluentd-docker.pos
me_format %Y-%m-%dT%H:%M:%S
g docker.*
rmat json
urce>

ch docker.var.lib.docker.containers.*.*.log>
pe docker_format
ntainer_id ${tag_parts[5]}
g docker.${name}
tch>

The output record will have two additional fields, container_id and container_name.

Contributing
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.