Docker Compose

Overview

Gathering logs from docker-compose scripts is easy to do and all it takes is for your to configure the fluentd driver to push data to Apica Ascent

Lets look at a simple compose file with a single service "web"

version: '3.7'
services:
  web:
    image: wordpress
    ports:
      - "89:8080"
    logging:
      driver: "fluentd"
      options:
        fluentd-address: 192.168.68.114:24224
        labels: "namespace,application,production_status,cluster_id"
        env: "os"
    labels:
      production_status: "testing"
      namespace: "us-east-1"
      application: "wordpress"
      cluster_id: "cluster1"
    environment:
      - os=ubuntu

Specifying the logging driver

The fluentd logging driver can be configured to send logs directly to Apica Ascent either via TLS or non-TLS. use port 24224 for non-TLS and port 24225 for TLS.

logging:
  driver: "fluentd"
  options:
    fluentd-address: 192.168.68.114:24224
    labels: "namespace,application,production_status,cluster_id"
    env: "os"

Adding metadata

Logs get organized in Apica Ascent as flows. A Flow is a combination of a Namespace and an application. You can optionally also add a third grouping attribute cluster_id.

Aside from this, the labels and environment section allows additional metadata to be sent with logs and can be used for search indexing, aggregate queries

labels:
  production_status: "testing"
  namespace: "us-east-1"
  application: "wordpress"
  cluster_id: "cluster1"
environment:
  - os=ubuntu

Last updated