Setup Docker

Current has builtin integration with Docker. This integration automatically pulls logs from all containers in the same way docker logs works and sends them up to current.sh.

It’s quite easy to set this using the current tool. The tool will calculate a container to spin up, show the commands to run, and if requested, run them!

  • To see the command, run current setup-docker -n <stream name>
  • To see the run the command, run current setup-docker -n <stream name> -e

This downloads an image from docker hub with all the proper code bits and starts up a container to manage the reading and sending of log data.

Stopping

To stop sending logs, simply kill the container with docker rm.

Options

There are a few knobs to control which containers are logged. There are 4 mechanisms to use to control this:

  • TTY: Any container that is using a TTY is not logged, for obvious reasons
  • Labels: Any container with the docker label logging.ignore defined will not have its output logged.
  • LOGGING variable: Any container with the environment variable LOGGING set to ignore will not have its output logged.
  • LOGSPOUT variable: Any container with the environment variable LOGSPOUT set to ignore will not have its output logged. This option is provided for users of the logspout tool to easily use current.sh logging as well.

Automatic values

  • Container name: The name of the container defined by docker is provided under the app tag.
  • Container ID: The container id defined by docker is provided under the procid tag.
  • Kubernetes Pod: If the docker container is running a kubernetes pod, the pod name is provided under the kubernetes.pod tag.
  • Kubernetes Namespace: If the docker container is running a kubernetes pod, the kubernetes namespace is proveded under the kubernetes.namespace tag.