Limiting logs stored by docker

Some containers within your application may produce large amounts of logs output. In these situations, it can be advantageous to limit how much of these logs are stored.

components:
  - name: Worker
    containers:
      - name: noisy_worker
        source: public
        image_name: main_worker
        version: 1.0.2
      - name: quiet_worker
        source: public
        image_name: secure_worker
        version: 1.0.2

Replicated provides options to limit docker log storage on both a container and component level with the logs property. For example, to limit the logs produced by the noisy container above to 10MB, you would add

logs:
    max_size: "10m"
    max_files: "1"

Resulting in

components:
  - name: Worker
    containers:
      - name: noisy_worker
        source: public
        image_name: main_worker
        version: 1.0.2
        logs:
            max_size: "10m"
            max_files: "1"
      - name: quiet_worker
        source: public
        image_name: secure_worker
        version: 1.0.2

max_size can have units of k, m, or g and must be a positive integer. Both of these parameters are passed directly to Docker and follow the format laid out in the logging documentation.

To configure the logs retained by Replicated Operator, see Configuring Application Log Retention.