From 20b7cb7c949a89f2d6636366554e024b5a0ad0b2 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 24 May 2022 18:11:38 -0300 Subject: Feat: log rotation for docker --- files/daemon.json | 7 +++++++ manifests/init.pp | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 files/daemon.json diff --git a/files/daemon.json b/files/daemon.json new file mode 100644 index 0000000..b8ab8c9 --- /dev/null +++ b/files/daemon.json @@ -0,0 +1,7 @@ +{ + "log-driver": "json-file", + "log-opts": { + "max-size": "10m", + "max-file": "3" + } +} diff --git a/manifests/init.pp b/manifests/init.pp index 55d3258..60c2cf1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,4 +8,14 @@ class docker { enable => true, require => Package['docker'], } + + # See https://docs.docker.com/config/containers/logging/json-file/ + file { '/etc/docker/daemon.json': + ensure => present, + owner => root, + group => root, + mode => '0644', + notify => Service['docker'], + source => 'puppet:///modules/docker/daemon.json', + } } -- cgit v1.2.3