Giter VIP home page Giter VIP logo

docker-logger's Introduction

docker-logger Go Report Card Docker Automated build

docker-logger is a small application collecting logs from other containers on the host that started without the -t option and configured with a logging driver that works with docker logs (journald and json-file). It can forward both stdout and stderr of containers to local, rotated files and/or to remote syslog.

note: dkll inlcudes all functionality of docker-logger, but adds server and cli client

Install

Copy provided docker-compose.yml, customize if needed and run with docker-compose up -d. By default docker-logger will collect all logs from containers and put it to ./logs directory.

Customization

All changes can be done via container's environment in docker-compose.yml or with command line

Command line Environment Default Description
--docker DOCKER_HOST unix:///var/run/docker.sock docker host
--syslog-host SYSLOG_HOST 127.0.0.1:514 syslog remote host (udp4)
--files LOG_FILES No enable logging to files
--syslog LOG_SYSLOG No enable logging to syslog
--max-size MAX_SIZE 10 size of log triggering rotation (MB)
--max-files MAX_FILES 5 number of rotated files to retain
--mix-err MIX_ERR false send error to std output log file
--max-age MAX_AGE 30 maximum number of days to retain
--exclude EXCLUDE excluded container names, comma separated
--include INCLUDE only included container names, comma separated
--include-pattern INCLUDE_PATTERN only include container names matching a regex
--exclude-pattern EXCLUDE_PATTERN only exclude container names matching a regex
TIME_ZONE UTC time zone for container
--json, -j JSON false output formatted as JSON
  • at least one of destinations (files or syslog) should be allowed
  • location of log files can be mapped to host via volume, ex: - ./logs:/srv/logs (see docker-compose.yml)
  • both --exclude and --include flags are optional and mutually exclusive, i.e. if --exclude defined --include not allowed, and vise versa.
  • both --include and --include-pattern flags are optional and mutually exclusive, i.e. if --include defined --include-pattern not allowed, and vise versa.

Build from the source

  • clone this repo - git clone https://github.com/yyewolf/docker-logger.git
  • build the logger - cd docker-logger && docker build -t yyewolf/docker-logger .
  • try it - docker run -it --rm -v $(pwd)/logs:/srv/logs -v /var/run/docker.sock:/var/run/docker.sock yyewolf/docker-logger /srv/docker-logger --files

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.