LogFlow

Docker

Forward container logs to LogFlow using the HTTP log driver or a sidecar collector.

Option 1 — HTTP log driver (simplest)

Docker's built-in gelf and splunk drivers don't support LogFlow directly, but the fluentd driver with a Fluent Bit sidecar does. The simplest approach is the HTTP log driver via a forwarder.

For a zero-dependency setup, instrument your app directly with one of the language SDKs (node, python, go, etc.) and log to LogFlow from inside the container.

Option 2 — Fluent Bit sidecar (recommended for production)

Fluent Bit reads stdout/stderr from your containers and forwards them to LogFlow via HTTP.

1. Create fluent-bit.conf

ini
[SERVICE]
    Flush        2
    Log_Level    warn

[INPUT]
    Name         forward
    Listen       0.0.0.0
    Port         24224

[OUTPUT]
    Name         http
    Match        *
    Host         api.getlogflow.com
    Port         443
    TLS          On
    URI          /v1/logs/batch
    Format       json
    Header       Authorization Bearer lf_YOUR_API_KEY
    Header       Content-Type application/json
    json_date_key timestamp
    json_date_format iso8601

2. docker-compose.yml

yaml
version: '3.8'

services:
  app:
    image: your-app:latest
    logging:
      driver: fluentd
      options:
        fluentd-address: localhost:24224
        tag: app.{{.Name}}
    environment:
      - NODE_ENV=production

  fluent-bit:
    image: fluent/fluent-bit:3
    volumes:
      - ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf:ro
    ports:
      - "24224:24224"
    restart: unless-stopped
💡
Add LOGFLOW_API_KEY as an environment variable and reference it in fluent-bit.conf with ${LOGFLOW_API_KEY} so the key never appears in your config file.

Option 3 — Direct from Dockerfile

For simple single-container apps, send logs from your app code without any sidecar:

dockerfile
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .

# API key injected at runtime, not baked in
ENV LOGFLOW_API_KEY=""
ENV NODE_ENV=production

CMD ["node", "server.js"]
bash
# Run with API key from environment
docker run \
  -e LOGFLOW_API_KEY=lf_YOUR_API_KEY \
  -p 3000:3000 \
  your-app:latest

Option 4 — Kubernetes with Fluent Bit DaemonSet

For Kubernetes clusters, deploy Fluent Bit as a DaemonSet to collect logs from all pods:

yaml
# fluent-bit-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: fluent-bit-config
  namespace: logging
data:
  fluent-bit.conf: |
    [SERVICE]
        Flush 5
        Log_Level warn

    [INPUT]
        Name              tail
        Path              /var/log/containers/*.log
        Parser            docker
        Tag               kube.*
        Refresh_Interval  5

    [OUTPUT]
        Name    http
        Match   *
        Host    api.getlogflow.com
        Port    443
        TLS     On
        URI     /v1/logs/batch
        Format  json
        Header  Authorization Bearer ${LOGFLOW_API_KEY}
        Header  Content-Type application/json
â„šī¸
Store your API key in a Kubernetes Secret and reference it via valueFrom.secretKeyRef in the DaemonSet spec — never hardcode it in ConfigMaps.

Useful attributes to add

Enrich your logs with container metadata via Fluent Bit's Kubernetes filter:

ini
[FILTER]
    Name                kubernetes
    Match               kube.*
    Kube_URL            https://kubernetes.default.svc:443
    Merge_Log           On
    K8S-Logging.Parser  On