Skip to content

Instantly share code, notes, and snippets.

@stympy
Created February 4, 2026 21:45
Show Gist options
  • Select an option

  • Save stympy/6ea7e472e720f92676ff50207d32a0cf to your computer and use it in GitHub Desktop.

Select an option

Save stympy/6ea7e472e720f92676ff50207d32a0cf to your computer and use it in GitHub Desktop.
Send Docker logs to Insights

You can use Vector with its docker_logs source to collect logs from your Docker containers and send them to Honeybadger Insights. This example collects logs from all running containers:

# Put this in vector.yaml
sources:
  docker:
    type: "docker_logs"

transforms:
  enrich_docker:
    type: "remap"
    inputs: ["docker"]
    source: |
      # Try to parse JSON log messages
      payload, err = parse_json(string!(.message))
      if err == null {
        .payload = payload
        del(.message)
      }

sinks:
  honeybadger_events:
    type: "http"
    inputs: ["enrich_docker"]
    uri: "https://api.honeybadger.io/v1/events"
    request:
      headers:
        X-API-Key: "{{PROJECT_API_KEY}}"
    encoding:
      codec: "json"
    framing:
      method: "newline_delimited"

To run Vector with Docker and collect logs from other containers, you need to mount the Docker socket. Here's a Docker Compose configuration:

services:
  vector:
    image: timberio/vector:latest-alpine
    volumes:
      - "./vector.yaml:/etc/vector/vector.yaml:ro"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  # Example app container whose logs will be collected
  app:
    image: your-app:latest
    labels:
      vector.enable: "true"

You can filter which containers Vector collects logs from using labels. Update the source configuration to only collect logs from containers with a specific label:

sources:
  docker:
    type: "docker_logs"
    include_labels:
      - "vector.enable=true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment