GithubHelp home page GithubHelp logo

max-lobur / centralized-container-logging Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 4 KB

A demo of centralized container logging via Logspout

License: MIT License

docker containers logspout logging rsyslog

centralized-container-logging's Introduction

Inputs

Using docker, setup three instances that communicate to each other.

  • a docker instance running rsyslog (centralized logging server)
  • a docker instance running rsyslog which forwards to the centralized logging server (logging agent)
  • a docker instance running nginx serving static content (app server)

Ensure that the app server's access logs are forwarded to the centralized logging server via the logging agent.

The ideal solution here should be re-usable. In production we would want to run one logging agent and many app server instances together on any host. This would provide us with an easy way to ship logs for each container from each docker host to the centralized logging service.

Requirements

  1. Include the ability to easily configure the address of the centralized logging server (it could change so just re-configuring the logging agent should be easy).
  2. Be able to easily choose what files we want to ship to the logging service.

Running the solution

Currently 3 services are merged into one yaml for convenience. It has comments about how it would be split in a real-world scenario.

  1. Start: docker-compose -f rsyslog.yml up -d
  2. Generate web logs: curl localhost:8080
  3. Observe log server logs: docker logs centralizedcontainerlogging_log-server_1
  4. Observe locally saved logs: cat ./logs/*
  5. Stop docker-compose -f rsyslog.yml down

Adressing Requirements

  1. Log server is linked via docker built-in service discovery, e.g. referred by name "log-server".
  2. Logspout used as a log-agent is only capturing container's stdout/stderr, which I believe is correct because a container should run no more than 1 process. Unlike a "Sidecar" approach you cannot list specific files here. However multiple message-level filters are available:

Extra credit

Centralized logging is available out-of-box in kubernetes: fluentd + elasticsearch + grafana/kibana

centralized-container-logging's People

Contributors

max-lobur avatar

Watchers

 avatar  avatar  avatar

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.