From 7b98e2679a1aab6ccaf753b7f274fd4950559d5a Mon Sep 17 00:00:00 2001 From: Kristine Bujold Date: Tue, 7 May 2019 16:18:10 -0400 Subject: [PATCH] Docker logs are not rotating Add docker logs to logrotate. Change-Id: Icd765ebdad1bad0ab53fdeafae6a447dde318c96 Closes-Bug: 1827322 Signed-off-by: Kristine Bujold --- .../docker-config/centos/build_srpm.data | 2 +- .../docker-config/centos/docker-config.spec | 1 + config-files/docker-config/files/Makefile | 2 + .../docker-config/files/docker.logrotate | 42 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 config-files/docker-config/files/docker.logrotate diff --git a/config-files/docker-config/centos/build_srpm.data b/config-files/docker-config/centos/build_srpm.data index 15dbe0dbc..1ecddecca 100644 --- a/config-files/docker-config/centos/build_srpm.data +++ b/config-files/docker-config/centos/build_srpm.data @@ -1,2 +1,2 @@ SRC_DIR="$PKG_BASE/files" -TIS_PATCH_VER=1 +TIS_PATCH_VER=2 diff --git a/config-files/docker-config/centos/docker-config.spec b/config-files/docker-config/centos/docker-config.spec index dc4145d3d..528d8f824 100644 --- a/config-files/docker-config/centos/docker-config.spec +++ b/config-files/docker-config/centos/docker-config.spec @@ -29,3 +29,4 @@ make DATADIR=%{buildroot}%{_datadir} SYSCONFDIR=%{buildroot}%{_sysconfdir} insta %dir %{_sysconfdir}/systemd/system/docker.service.d %{_sysconfdir}/pmon.d/docker.conf %{_sysconfdir}/systemd/system/docker.service.d/docker-stx-override.conf +%{_sysconfdir}/logrotate.d/docker.logrotate \ No newline at end of file diff --git a/config-files/docker-config/files/Makefile b/config-files/docker-config/files/Makefile index 10662c559..4007dd76d 100644 --- a/config-files/docker-config/files/Makefile +++ b/config-files/docker-config/files/Makefile @@ -9,3 +9,5 @@ install: install -D -m 644 docker-pmond.conf $(SYSCONFDIR)/pmon.d/docker.conf install -d -m 0755 $(SYSCONFDIR)/systemd/system/docker.service.d install -D -m 644 docker-stx-override.conf $(SYSCONFDIR)/systemd/system/docker.service.d/docker-stx-override.conf + install -d -m 0755 $(SYSCONFDIR)/logrotate.d + install -D -m 644 docker.logrotate $(SYSCONFDIR)/logrotate.d/docker.logrotate \ No newline at end of file diff --git a/config-files/docker-config/files/docker.logrotate b/config-files/docker-config/files/docker.logrotate new file mode 100644 index 000000000..a027840f5 --- /dev/null +++ b/config-files/docker-config/files/docker.logrotate @@ -0,0 +1,42 @@ +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# + +# copytruncate: Truncate the original log file in place after creating a copy, +# instead of moving the old log file and optionally creating a new one. It is +# used when some program can not be told to close its logfile and thus might +# continue writing (appending) to the previous log file forever. This prevents +# having to possibly reset the file handle of the log file. + +/var/lib/docker/containers/*/*-json.log +{ + nodateext + size 50M + start 1 + rotate 20 + missingok + notifempty + compress + delaycompress + copytruncate +} + +/var/lib/docker/overlay2/*/diff/var/log/apt/history.log +/var/lib/docker/overlay2/*/diff/var/log/bootstrap.log +/var/lib/docker/overlay2/*/diff/var/log/apt/term.log +/var/lib/docker/overlay2/*/diff/var/log/dpkg.log +/var/lib/docker/overlay2/*/diff/var/log/alternatives.log +{ + nodateext + size 10M + start 1 + rotate 20 + missingok + notifempty + compress + delaycompress + copytruncate +}