Categorygithub.com/umputun/docker-logger
module
1.3.0
Repository: https://github.com/umputun/docker-logger.git
Documentation: pkg.go.dev

# README

docker-logger Actions Status 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 lineEnvironmentDefaultDescription
--dockerDOCKER_HOSTunix:///var/run/docker.sockdocker host
--syslog-hostSYSLOG_HOST127.0.0.1:514syslog remote host (udp4)
--filesLOG_FILESNoenable logging to files
--syslogLOG_SYSLOGNoenable logging to syslog
--max-sizeMAX_SIZE10size of log triggering rotation (MB)
--max-filesMAX_FILES5number of rotated files to retain
--mix-errMIX_ERRfalsesend error to std output log file
--max-ageMAX_AGE30maximum number of days to retain
--excludeEXCLUDEexcluded container names, comma separated
--includeINCLUDEonly included container names, comma separated
--include-patternINCLUDE_PATTERNonly include container names matching a regex
TIME_ZONEUTCtime zone for container
--json, -jJSONfalseoutput 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/umputun/docker-logger.git
  • build the logger - cd docker-logger && docker build -t umputun/docker-logger .
  • try it - docker run -it --rm -v $(pwd)/logs:/srv/logs -v /var/run/docker.sock:/var/run/docker.sock umputun/docker-logger /srv/docker-logger --files

# Packages

No description provided by the author