Sign inSign up

matanper/docker-service-logger

By matanper

•Updated over 7 years ago

simple script to monitor and log swarm services' liveness

Image
1

132

matanper/docker-service-logger repository overview

⁠Docker Service Logger

Dockereized simple script to monitor swarm services liveness. Logs are written to the system output and can be transferred to monitoring systems such as ELK/splunk

⁠Log format

the log is in json format and contain the following fields:

  • service - the name of the service
  • mode - the mode of deployment of the service (global/replicated)
  • replicas_text - number of running instances as text for display
  • running - number of running instances
  • total - the total number of instances which should run
  • running_pct - perecentage of running instance out of total
⁠Example Logs
{"service":"metricbeat","mode":"global","replicas_text":"5/5","running":5,"total":5,"running_pct":1}
{"service":"redis","mode":"replicated","replicas_text":"3/4","running":3,"total":4,"running_pct":0.75}

⁠Versions

There are two versios, debian which comes without the docker binaries and must be mounted against docker on the host, and alpine which contains docker binaries inside and needs to mount only the docker sock

⁠Usage

⁠Command line

alpine version:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock docker-service-logger:alpine-1.0

debian version:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker docker-service-logger:debian-1.0
⁠Compose file
version: '3.7'
services:
  services-logger:
    image: 'docker-service-logger:alpine-1.0'
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      deploy:
        replicas: 1
        placement:
          constraints:
            - node.role == manager

Tag summary

Content type

Image

Digest

Size

78.8 MB

Last updated

over 7 years ago

docker pull matanper/docker-service-logger:alpine-1.0