# openshift/cluster-logging-operator architecture

> Architecture diagram of the GitHub repository openshift/cluster-logging-operator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openshift/cluster-logging-operator
- Repository: https://github.com/openshift/cluster-logging-operator

## Overview

Cluster Logging Operator manages OpenShift APIs that configure cluster log collection and forwarding; it deploys Vector rather than storing logs itself. The principal workflow is a ClusterLogForwarder resource entering reconciliation, initialization and validation, then collector/configuration deployment and Kubernetes resource updates. The graph also preserves the LogFileMetricsExporter capability and must-gather diagnostics. Source excerpts establish controller initialization and validation, pipeline wiring, receiver-service reconciliation, and metric-exporter reconciliation; some collector-to-generator internals are unsampled, so those links are omitted or marked unverified.

Main entry points: [`internal/controller/observability/clusterlogforwarder_controller.go`](https://github.com/openshift/cluster-logging-operator/blob/master/internal/controller/observability/clusterlogforwarder_controller.go) (Forwarder Controller), [`internal/collector`](https://github.com/openshift/cluster-logging-operator/tree/master/internal/collector) (Collector Resources), [`cmd/main.go`](https://github.com/openshift/cluster-logging-operator/blob/master/cmd/main.go) (Operator Manager), [`must-gather/gather.go`](https://github.com/openshift/cluster-logging-operator/blob/master/must-gather/gather.go) (Must-Gather Command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration APIs"]
  node_clf_api["Forwarder API"]
  node_lfme_api["Metrics Exporter API"]
end

subgraph group_reconcile["Operator Reconciliation"]
  node_operator["Operator Manager<br/>[main.go]"]
  node_clf_controller["Forwarder Controller"]
  node_initialization["Spec Initialization"]
  node_validation["Spec Validation"]
  node_admin_policy["Protected SA Policy"]
end

subgraph group_collection["Collection and Forwarding"]
  node_collector["Collector Resources"]
  node_receiver_services["Receiver Services<br/>[input_service.go]"]
  node_network_services["Service Reconciliation<br/>[service.go]"]
  node_vector_config["Vector Config Model<br/>[pipeline.go]"]
  node_forwarder_generator["Forwarder Generator<br/>[generator.go]"]
  node_vector["Vector Collector"]
end

subgraph group_metrics["Metrics Export"]
  node_lfme_controller["Exporter Controller"]
  node_lfme_runtime["Exporter Deployment"]
end

subgraph group_diagnostics["Diagnostics"]
  node_must_gather["Must-Gather Command<br/>[gather.go]"]
  node_gather_client["Cluster Client<br/>[client.go]"]
  node_cluster_data["Cluster Diagnostics<br/>[collector.go]"]
end

node_admin(("Cluster Admin"))
node_kube[("Kubernetes API")]
node_loki[("Loki Storage")]
node_external_sinks[("External Log Stores")]
node_monitoring["Prometheus Monitoring"]

node_admin -->|"configures"| node_clf_api
node_admin -->|"configures"| node_lfme_api
node_clf_api -.->|"creates resource"| node_kube
node_lfme_api -.->|"creates resource"| node_kube
node_operator -->|"registers"| node_clf_controller
node_clf_controller -->|"reads and updates"| node_kube
node_clf_controller -->|"initializes"| node_initialization
node_clf_controller -->|"validates"| node_validation
node_clf_controller -->|"reconciles"| node_collector
node_collector -.->|"reconciles"| node_receiver_services
node_receiver_services -->|"requests"| node_network_services
node_collector -.->|"generates configuration"| node_vector_config
node_vector_config -.->|"configures pipelines"| node_forwarder_generator
node_collector -->|"deploys"| node_vector
node_vector -.->|"forwards logs"| node_loki
node_vector -->|"forwards logs"| node_external_sinks
node_operator -->|"registers"| node_lfme_controller
node_lfme_controller -->|"reconciles"| node_lfme_runtime
node_lfme_runtime -.->|"deploys resources"| node_kube
node_monitoring -.->|"scrapes metrics"| node_lfme_runtime
node_operator -->|"registers"| node_admin_policy
node_admin_policy -->|"reconciles access"| node_kube
node_admin -->|"runs diagnostics"| node_must_gather
node_must_gather -->|"collects through"| node_gather_client
node_must_gather -->|"collects"| node_cluster_data
node_gather_client -->|"queries"| node_kube

click node_clf_api "https://github.com/openshift/cluster-logging-operator/blob/master/api/observability/v1/clusterlogforwarder_types.go"
click node_lfme_api "https://github.com/openshift/cluster-logging-operator/blob/master/api/logging/v1alpha1/log_file_metrics_exporter_types.go"
click node_operator "https://github.com/openshift/cluster-logging-operator/blob/master/cmd/main.go"
click node_clf_controller "https://github.com/openshift/cluster-logging-operator/blob/master/internal/controller/observability/clusterlogforwarder_controller.go"
click node_initialization "https://github.com/openshift/cluster-logging-operator/tree/master/internal/api/initialize"
click node_validation "https://github.com/openshift/cluster-logging-operator/tree/master/internal/validations/observability"
click node_collector "https://github.com/openshift/cluster-logging-operator/tree/master/internal/collector"
click node_receiver_services "https://github.com/openshift/cluster-logging-operator/blob/master/internal/collector/input_service.go"
click node_network_services "https://github.com/openshift/cluster-logging-operator/blob/master/internal/network/service.go"
click node_vector_config "https://github.com/openshift/cluster-logging-operator/blob/master/internal/generator/vector/adapters/pipeline.go"
click node_forwarder_generator "https://github.com/openshift/cluster-logging-operator/blob/master/internal/generator/forwarder/generator.go"
click node_lfme_controller "https://github.com/openshift/cluster-logging-operator/blob/master/internal/controller/logfilemetricsexporter/logfilemetricsexporter_controller.go"
click node_lfme_runtime "https://github.com/openshift/cluster-logging-operator/tree/master/internal/metrics/logfilemetricexporter"
click node_must_gather "https://github.com/openshift/cluster-logging-operator/blob/master/must-gather/gather.go"
click node_gather_client "https://github.com/openshift/cluster-logging-operator/blob/master/must-gather/internal/client/client.go"
click node_cluster_data "https://github.com/openshift/cluster-logging-operator/blob/master/must-gather/internal/cluster/collector.go"
click node_admin_policy "https://github.com/openshift/cluster-logging-operator/blob/master/internal/admission/protected_sa_policy.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_clf_api,node_lfme_api toneBlue
class node_operator,node_clf_controller,node_initialization,node_validation,node_admin_policy,node_kube,node_loki,node_external_sinks toneAmber
class node_collector,node_receiver_services,node_network_services,node_vector_config,node_forwarder_generator,node_vector toneMint
class node_lfme_controller,node_lfme_runtime toneRose
class node_must_gather,node_gather_client,node_cluster_data,node_admin,node_monitoring toneIndigo
```

## Components

### Configuration APIs

- [Forwarder API](https://github.com/openshift/cluster-logging-operator/blob/master/api/observability/v1/clusterlogforwarder_types.go): `api/observability/v1/clusterlogforwarder_types.go`
- [Metrics Exporter API](https://github.com/openshift/cluster-logging-operator/blob/master/api/logging/v1alpha1/log_file_metrics_exporter_types.go): `api/logging/v1alpha1/log_file_metrics_exporter_types.go`

### Operator Reconciliation

- [Operator Manager](https://github.com/openshift/cluster-logging-operator/blob/master/cmd/main.go): `cmd/main.go`
- [Forwarder Controller](https://github.com/openshift/cluster-logging-operator/blob/master/internal/controller/observability/clusterlogforwarder_controller.go): `internal/controller/observability/clusterlogforwarder_controller.go`
- [Spec Initialization](https://github.com/openshift/cluster-logging-operator/tree/master/internal/api/initialize): `internal/api/initialize`
- [Spec Validation](https://github.com/openshift/cluster-logging-operator/tree/master/internal/validations/observability): `internal/validations/observability`
- [Protected SA Policy](https://github.com/openshift/cluster-logging-operator/blob/master/internal/admission/protected_sa_policy.go): `internal/admission/protected_sa_policy.go`

### Collection and Forwarding

- [Collector Resources](https://github.com/openshift/cluster-logging-operator/tree/master/internal/collector): `internal/collector`
- [Receiver Services](https://github.com/openshift/cluster-logging-operator/blob/master/internal/collector/input_service.go): `internal/collector/input_service.go`
- [Service Reconciliation](https://github.com/openshift/cluster-logging-operator/blob/master/internal/network/service.go): `internal/network/service.go`
- [Vector Config Model](https://github.com/openshift/cluster-logging-operator/blob/master/internal/generator/vector/adapters/pipeline.go): `internal/generator/vector/adapters/pipeline.go`
- [Forwarder Generator](https://github.com/openshift/cluster-logging-operator/blob/master/internal/generator/forwarder/generator.go): `internal/generator/forwarder/generator.go`
- **Vector Collector**

### Metrics Export

- [Exporter Controller](https://github.com/openshift/cluster-logging-operator/blob/master/internal/controller/logfilemetricsexporter/logfilemetricsexporter_controller.go): `internal/controller/logfilemetricsexporter/logfilemetricsexporter_controller.go`
- [Exporter Deployment](https://github.com/openshift/cluster-logging-operator/tree/master/internal/metrics/logfilemetricexporter): `internal/metrics/logfilemetricexporter`

### Diagnostics

- [Must-Gather Command](https://github.com/openshift/cluster-logging-operator/blob/master/must-gather/gather.go): `must-gather/gather.go`
- [Cluster Client](https://github.com/openshift/cluster-logging-operator/blob/master/must-gather/internal/client/client.go): `must-gather/internal/client/client.go`
- [Cluster Diagnostics](https://github.com/openshift/cluster-logging-operator/blob/master/must-gather/internal/cluster/collector.go): `must-gather/internal/cluster/collector.go`

### Other components

- **Cluster Admin**
- **Kubernetes API**
- **Loki Storage**
- **External Log Stores**
- **Prometheus Monitoring**

## Connections

- Cluster Admin → Forwarder API: configures (evidence: `README.adoc`)
- Cluster Admin → Metrics Exporter API: configures (evidence: `README.adoc`)
- Forwarder API → Kubernetes API: creates resource (evidence: `README.adoc`)
- Metrics Exporter API → Kubernetes API: creates resource (evidence: `README.adoc`)
- Operator Manager → Forwarder Controller: registers (evidence: `cmd/main.go`)
- Forwarder Controller → Kubernetes API: reads and updates (evidence: `internal/controller/observability/clusterlogforwarder_controller.go`)
- Forwarder Controller → Spec Initialization: initializes (evidence: `internal/controller/observability/clusterlogforwarder_controller.go`)
- Forwarder Controller → Spec Validation: validates (evidence: `internal/controller/observability/clusterlogforwarder_controller.go`)
- Forwarder Controller → Collector Resources: reconciles (evidence: `internal/controller/observability/clusterlogforwarder_controller.go`)
- Collector Resources → Receiver Services: reconciles
- Receiver Services → Service Reconciliation: requests (evidence: `internal/collector/input_service.go`)
- Collector Resources → Vector Config Model: generates configuration
- Vector Config Model → Forwarder Generator: configures pipelines
- Collector Resources → Vector Collector: deploys (evidence: `README.adoc`)
- Vector Collector → Loki Storage: forwards logs (evidence: `README.adoc`)
- Vector Collector → External Log Stores: forwards logs (evidence: `README.adoc`)
- Operator Manager → Exporter Controller: registers (evidence: `cmd/main.go`)
- Exporter Controller → Exporter Deployment: reconciles (evidence: `internal/controller/logfilemetricsexporter/logfilemetricsexporter_controller.go`)
- Exporter Deployment → Kubernetes API: deploys resources
- Prometheus Monitoring → Exporter Deployment: scrapes metrics
- Operator Manager → Protected SA Policy: registers (evidence: `cmd/main.go`)
- Protected SA Policy → Kubernetes API: reconciles access (evidence: `internal/admission/protected_sa_policy.go`)
- Cluster Admin → Must-Gather Command: runs diagnostics (evidence: `README.adoc`)
- Must-Gather Command → Cluster Client: collects through (evidence: `must-gather/gather.go`)
- Must-Gather Command → Cluster Diagnostics: collects (evidence: `must-gather/gather.go`)
- Cluster Client → Kubernetes API: queries (evidence: `must-gather/internal/client/client.go`)
