logio icon indicating copy to clipboard operation
logio copied to clipboard

Auto-discover docker containers, allow config, auto update when containers are created/destroyed

Open taxilian opened this issue 7 years ago • 2 comments

Hi,

You probably won't actually consider this ready to merge, but I thought I'd pass it along in case you're interested; it is 100% working and we're using it in production.

I use the following script to start it:

#!/usr/bin/env bash
DOCKER_IMG=logio
CNAME=logio_harvester
docker pull $DOCKER_IMG
docker stop $CNAME
docker rm $CNAME
docker run -d \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    -v /var/lib/docker/containers:/var/lib/docker/containers \
    -e LOGIO_HARVESTER_NODENAME=`hostname -f` \
    -e LOGIO_HARVESTER_MASTER_HOST=172.16.0.50 \
    --user root \
    --restart=always \
    --name $CNAME \
    $DOCKER_IMG harvester

When it starts it queries docker.sock to get a list of all running containers and their log file; it allows the container to override the stream name by setting the "LOGIO_STREAM" variable on the container if desired. There are some other options in there as well.

If a container is started or stopped it will automatically update the config file and restart the harvester.

taxilian avatar Jul 12 '17 21:07 taxilian

I really like your implementation, as it represents what the logio image should be from the beginning. It's awesome!

As a matter of fact it would be hard for me to support this image with this completely rewrite including multiple technologies I do not master and therefore ask you to either become a main contributor to this repository.

blacklabelops avatar Jul 13 '17 19:07 blacklabelops

Sure, I can help keep things running. You'll notice I did have to change the base image somewhat in order to install everything I needed; you might know a better way to do it, just need node.js 6.x or later for my code to work. Anyway, just let me know how I can help and if you have any requests for changes. it's mostly the docs that I'm bad at writing =]

taxilian avatar Jul 13 '17 20:07 taxilian