Ship Container logs to Sophie using the Loom collector container


Description

Run a collector-container that will gather logs from other containers running on the same host and ship them to Sophie

Release or Environment

Sophie standalone versions 3.4.x - 3.7.x

Instructions

NOTE: if using Kubernetes, we recommend installing a DaemonSet, as described in this article.

This container sends the logs of all other containers in the same host machine to Loom.

Running the container 

Copy the command, replacing {{customer-name}} with your customer name (you can find it in the domain name you use to access Loom, e.g. this-part.loomsystems.com):

docker run --name loom-collector-docker \
    -e CUSTOMER_NAME={{customer-name}} \
    --privileged \
    -d \
    -v /var/lib/docker/containers:/containers:ro \
    loomsystems/loom-collector-docker

When it starts, the container automatically begins listening to logs of other containers and sends them to Loom. It will identify other containers being added or removed dynamically.

Requirements

Configuration

The following configuration options can be set with the corresponding environment variables (use -e ENV_VAR_NAME=some_value  option when running the container) 

The container uses FileBeat internally. See the documentation of the above settings in the official FileBeat documentation.

Why not use a Sock?

The container uses the option-v to mount the folder containing all other containers logs, as READ ONLY . This is considered more secure than using a socket; Since the socket communicates directly with the docker daemon, which runs as root, using it represents a potential security threat to the local machine.