Enabling ServiceMonitors for fluentd and fluentbit in rancher-logging
Article Number: 000021712
Environment
- SUSE Rancher v2.9+
- rancher-monitoring installed
- rancher-logging installed
Situation
There are several ways of enabling ServiceMonitors in the rancher-logging helm chart, for both fluentd and fluent bit. This article details the correct configuration to ensure the ServiceMonitors are enabled for all logging instances.
Resolution
Rancher v2.10+
In Rancher v2.10+, with rancher-logging 105.0.0+up4.8.0 and above, ServiceMonitors can be configured via the fluentd.metrics.serviceMonitor and fluentbit.metrics.serviceMonitor values of the rancher-logging Helm Chart:
fluentd:
metrics:
serviceMonitor: true
fluentbit:
metrics:
serviceMonitor: true
Rancher v2.9
In Rancher v2.9 an overlay configuration is needed for it to work correctly and expose the metrics offered by both fluentd and fluent bit. To do so, the following parameters have to be defined in the values of the rancher-logging Helm Chart:
loggingOverlay:
spec:
fluentd:
metrics:
serviceMonitor: true
fluentbitAgentOverlay:
spec:
metrics:
serviceMonitor: true
After upgrading the chart with these values, the metrics will start to appear in rancher-monitoring.