For the complete documentation index, see llms.txt. This page is also available as Markdown.

🐳Docker

Collect container logs, and forward OpenTelemetry metrics and traces, from a Docker host.

Collect container logs from a Docker host with the ControlTheory agent, which runs as a single container on the host and forwards data to Dstl8. Applications on the host can also send the agent their own logs, metrics and traces over OpenTelemetry (OTLP), and the agent forwards those too.

How it works

The ControlTheory agent runs as one container (named aigent) on each Docker host. It reads the logs of the other containers on that host and forwards them to Dstl8. It also listens on the host for OpenTelemetry (OTLP) logs, metrics and traces, so applications on the same host can send their own telemetry to it:

Host port
Protocol

4317

OTLP/gRPC

4318

OTLP/HTTP

Add one Docker source per host, or per group of hosts you want to treat as one environment. Each source gets its own admission token.

Before you start

  • A Linux host with Docker installed, and a user that can run docker commands (run the install command as that user, or with sudo).

  • curl on the host, and outbound HTTPS access from the host to Dstl8.

  • To read other containers' logs, the agent container runs privileged and mounts the Docker socket, the Docker container log directory (read-only), and /var/log. If your security policy doesn't allow that on a host, don't install the agent there.

  • Host ports 4317 and 4318 must be free. The agent always publishes its OTLP listeners on these two ports, so a host that already runs an OpenTelemetry collector on them can't run the agent until that collector moves to other ports.

  • The command creates a ./data directory in the folder you run it from, which the agent uses for its own state. Run it from a folder that will stay in place. If you run the command with sudo, the folder is owned by root, so removing it later also needs sudo.

Add a Docker source

1. Create the source in Dstl8

From Sources, click Add Source and select Docker. On the Configure Docker Source step, fill in:

Field
Notes

Name

Required. A unique name to identify this source.

Cluster Name (optional)

Name used to attribute telemetry to this host or group of hosts. Defaults to docker.

Deployment Environment

Required. Environment name for filtering and grouping, e.g. prod, staging, dev.

Click Create.

2. Install the agent

The Install the Collector step shows a ready-to-run command with your organization, token and source values already filled in. Click Copy and run it on your Docker host. It has this shape:

Always copy the command from Dstl8 rather than typing it, so the token and IDs are correct. Treat the token like a password. Don't paste it into tickets or commit it to source control.

When the script finishes it prints ControlTheory Agent install done. Click Done in Dstl8.

To see the command again later, open Sources, open the Docker source's actions menu (gear icon) and select Install Script.

3. Verify

On the host, confirm the container is running:

In Dstl8, the source shows Listening for telemetry and turns Healthy once the agent connects, usually within a couple of minutes. Streams appear on the Sources page as your containers write logs. Then assign the streams to a workspace so they're accessible there.

Send your own telemetry to the agent

Applications on the host can export OTLP logs, metrics and traces to the agent, instead of (or as well as) writing logs to stdout. Metrics show up under Explore → Metrics and traces under Explore → Traces, organized by service; see Metrics and Traces. Use an address that reaches the host from where the application runs:

  • An application running directly on the host: localhost.

  • An application in a container: not localhost, which is the container itself. Use the host's IP address, the Docker bridge gateway (usually 172.17.0.1), or host.docker.internal (on Linux, start the container with --add-host=host.docker.internal:host-gateway).

For an application using an OpenTelemetry SDK, set the standard environment variable:

Set the protocol along with the endpoint: SDKs differ in their default, and one sending HTTP to the gRPC port (or the other way round) fails to export.

For an OpenTelemetry Collector, point its exporter at the agent and add it to each pipeline you want in Dstl8:

Set service.name on everything you send (or OTEL_SERVICE_NAME in an SDK). It names the service your metrics and traces are filed under, and ties them to the service's logs.

The OTLP listeners are plain (unencrypted) and unauthenticated, so only expose these ports to networks you trust, and use your firewall or security group to keep them off the public internet.

Update the agent

Uninstall the running agent with the Uninstall Script (see Uninstall), then run the install command from Install Script again. The install command always creates a container named aigent, so the old one must be removed first. Updating also brings the agent version that forwards metrics and traces, if yours predates them (see Agent versions).

Uninstall

Open Sources, open the Docker source's actions menu (gear icon) and select Uninstall Script. Copy the command and run it on the Docker host. It has this shape:

Deleting a Docker source shows the same uninstall command first, with Continue to Delete. Uninstalling stops collection; the source stays in Dstl8 until you delete it. The ./data folder the install created can be deleted once the agent is gone.

If you can't run the script, removing the container by hand also stops the agent:

Troubleshooting

Symptom
What to check

Source stays Listening for telemetry

Run docker logs aigent. Confirm the host can reach Dstl8 over HTTPS (proxies and egress firewalls are the usual cause), and that the command was copied in full with the correct token.

the agent container 'aigent' is already running on this host

An agent is already installed on this host. Uninstall it first, then rerun.

permission denied from Docker

Run the command as a user that can access the Docker socket, or with sudo.

Ports 4317 or 4318 already in use

Another service on the host (often an OpenTelemetry collector) is using them. Stop it or move it to other ports, then run the install command again.

Metrics or traces don't arrive

Check the application exports to port 4318 with http/protobuf, or to 4317 with grpc, and that the exporter is on its metrics and traces pipelines. An agent installed before metrics and traces were supported forwards logs only: update it as above.

Source is Healthy but a container's logs are missing

Make sure the container writes to stdout/stderr with Docker's default json-file logging driver, and that you've assigned the stream to a workspace.

Tips

  • Install a separate Docker source per environment so streams don't collide, and set Deployment Environment accordingly.

  • Running containers on Amazon ECS or Kubernetes instead? See Amazon ECS and Kubernetes.

Last updated