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 <tnielsen@redhat.com>
(cherry picked from commit 055c22f4c4)
This commit is contained in:
Travis Nielsen authored and Mergify committed 2022-08-30 15:18:12 +00:00
1 parent 069c4f18c1
commit f4f39512e4
2 files changed
+8 -5

No files matched your search

+2 -2
View File
@@ -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",
+6 -3
View File
@@ -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
// <CLUSTER_FSID>-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