# 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"*

```yaml
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.

```yaml
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

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

<figure><img src="https://2948796384-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LmzGprckLqwd5v6bs6m%2Fuploads%2Fb613OZU1HLAdjoxpgnGt%2FScreen%20Shot%202023-01-26%20at%203.15.25%20PM.png?alt=media&#x26;token=97866eb2-64ce-4404-956d-594bac806e5e" alt=""><figcaption><p>Cluster ID, Namespace, Application mapping</p></figcaption></figure>

<figure><img src="https://2948796384-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LmzGprckLqwd5v6bs6m%2Fuploads%2Fa52RMx1mSk867C34v2X4%2FScreen%20Shot%202023-01-26%20at%203.16.30%20PM.png?alt=media&#x26;token=101690a4-1ed8-4476-9b07-3fc06245ddef" alt=""><figcaption><p>Additional Metadata</p></figcaption></figure>
