Giter VIP home page Giter VIP logo

fluentd-docker-image's Introduction

Fluentd docker image

Docker Stars Docker Pulls ImageLayers Size ImageLayers Layers

This container image is to create endpoint to collect logs on your host.

docker run -d -p 24224:24224 -v /data:/fluentd/log fluent/fluentd

Default configurations are to:

  • listen port 24224 for fluentd forward protocol
  • store logs with tag docker.** into /fluentd/log/docker.*.log (and symlink docker.log)
  • store all other logs into /fluentd/log/data.*.log (and symlink data.log)

This image uses Alpine Linux. If you want to use Ubuntu based image, use ubuntu-base tag.

Configurable ENV variables

Environment variable below are configurable to control how to execute fluentd process:

FLUENTD_CONF

It's for configuration file name, specified for -c.

If you want to use your own configuration file (without any optional plugins), you can use it over this ENV variable and -v option.

  1. write configuration file with filename yours.conf
  2. execute docker run with -v /path/to/dir:/fluentd/etc to share /path/to/dir/yours.conf in container, and -e FLUENTD_CONF=yours.conf to read it

FLUENTD_OPT

Use this variable to specify other options, like -v or -q.

How to build your own image

It is very easy to use this image as base image. Write your Dockerfile and configuration files, and/or your own plugin files if needed.

FROM fluent/fluentd:latest
MAINTAINER your_name <...>
USER fluent
WORKDIR /home/fluent
ENV PATH /home/fluent/.gem/ruby/2.2.0/bin:$PATH
RUN gem install fluent-plugin-secure-forward
EXPOSE 24284
CMD fluentd -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_OPT

Files below are automatically included in build process:

fluent.conf: used instead of default file plugins/*: copied into /fluentd/plugins and loaded at runtime

Testing

docker run --log-driver=fluentd --log-opt fluentd-address=192.168.0.1:24224 IMAGE echo "Hello Fluentd"  

Should produce a log-file with Hello Fluentd, depending on you fluent.conf file.

References

Docker Logging | fluentd.org

Fluentd logging driver - Docker Docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.