Monitor your logging pipeline with Prometheus Operator
You can configure the Logging operator to expose metrics endpoints for Fluentd, Fluent Bit, and syslog-ng using ServiceMonitor resources. That way, a Prometheus operator running in the same cluster can automatically fetch your logging metrics.
Metrics Variables
You can configure the following metrics-related options in the spec.fluentd.metrics, spec.syslogNG.metrics, and spec.fluentbit.metrics sections of your Logging resource.
Variable Name | Type | Required | Default | Description |
---|---|---|---|---|
interval | string | No | “15s” | Scrape Interval |
timeout | string | No | “5s” | Scrape Timeout |
port | int | No | - | Metrics Port. |
path | int | No | - | Metrics Path. |
serviceMonitor | bool | No | false | Enable to create ServiceMonitor for Prometheus operator |
prometheusAnnotations | bool | No | false | Add prometheus labels to fluent pods. |
For example:
For more details on installing the Prometheus operator and configuring and accessing metrics, see the following procedures.
Install Prometheus Operator with Helm
-
Create
logging
namespace -
Install Prometheus Operator
Prometheus Operator Documentation The prometheus-operator install may take a few more minutes. Please be patient. The logging-operator metrics function depends on the prometheus-operator’s resources. If those do not exist in the cluster it may cause the logging-operator’s malfunction.
Install Logging Operator with Helm
-
Install the Logging operator into the logging namespace:
Expected output:
Note:
-
Helm has a known issue in version 3.13.0 that requires users to log in to the registry, even though the repo is public.
Upgrade to 3.13.1 or higher to avoid having to log in, see: https://github.com/kube-logging/logging-operator/issues/1522
-
If you’re installing the Helm chart from Terraform, reference the repository as
repository = "oci://ghcr.io/kube-logging/helm-charts/"
(without thelogging-operator
suffix). Otherwise, you’ll get a 403 Forbidden error.
-
Install Minio
-
Create Minio Credential Secret
-
Deploy Minio
-
Create
logging
resourceNote:
ClusterOutput
andClusterFlow
resource will only be accepted in thecontrolNamespace
-
Create Minio output definition
Note: For production set-up we recommend using longer
timekey
interval to avoid generating too many object. -
Create
flow
resource -
Install log-generator to produce logs with the label
app.kubernetes.io/name: log-generator
Validation
Minio
-
Get Minio login credentials
-
Forward Service
-
Open the Minio Dashboard: http://localhost:9001
Prometheus
-
Forward Service
-
Open the Prometheus Dashboard: http://localhost:9090
Grafana
-
Get Grafana login credentials
Default username:
admin
-
Forward Service
-
Open Grafana Dashboard: http://localhost:3000