From 055c22f4c45f20b406272be92b9c6cab03b6f6a4 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Mon, 29 Aug 2022 11:26:05 -0600 Subject: [PATCH] rbdmirror: rotate logs for rbd mirroring The rbd mirror daemon logs to two files, one for the lodal mirror daemon and one log from the other cluster where the mirroring is taking place. The log rotation was only rotating one of the logs. Now we make the log rotation more general to catch all of the rbd mirror logs from different clusters. Signed-off-by: Travis Nielsen --- .commitlintrc.json | 4 ++-- pkg/operator/ceph/cluster/rbd/spec.go | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.commitlintrc.json b/.commitlintrc.json index 572f86773..62ca5cf61 100644 --- a/.commitlintrc.json +++ b/.commitlintrc.json @@ -10,7 +10,7 @@ "block", "bot", "build", - "cephfs-mirror", + "cephfsmirror", "ci", "core", "csi", @@ -28,7 +28,7 @@ "operator", "osd", "pool", - "rbd-mirror", + "rbdmirror", "rgw", "security", "subvolumegroup", diff --git a/pkg/operator/ceph/cluster/rbd/spec.go b/pkg/operator/ceph/cluster/rbd/spec.go index 9a410284a..dc85ec565 100644 --- a/pkg/operator/ceph/cluster/rbd/spec.go +++ b/pkg/operator/ceph/cluster/rbd/spec.go @@ -17,8 +17,6 @@ limitations under the License. package rbd import ( - "fmt" - cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1" "github.com/rook/rook/pkg/operator/ceph/config" "github.com/rook/rook/pkg/operator/ceph/controller" @@ -52,7 +50,12 @@ func (r *ReconcileCephRBDMirror) makeDeployment(daemonConfig *daemonConfig, rbdM if r.cephClusterSpec.LogCollector.Enabled { shareProcessNamespace := true podSpec.Spec.ShareProcessNamespace = &shareProcessNamespace - podSpec.Spec.Containers = append(podSpec.Spec.Containers, *controller.LogCollectorContainer(fmt.Sprintf("ceph-client.rbd-mirror.%s", daemonConfig.DaemonID), r.clusterInfo.Namespace, *r.cephClusterSpec)) + + // The rbd mirror daemon logs to multiple logs, so we need a more generous log rotation filter for files: + // ceph-client.rbd-mirror.a.log + // -client.rbd-mirror-peer.log + logRotationFilter := "*-client.rbd-mirror*" + podSpec.Spec.Containers = append(podSpec.Spec.Containers, *controller.LogCollectorContainer(logRotationFilter, r.clusterInfo.Namespace, *r.cephClusterSpec)) } // Replace default unreachable node toleration