Este contenido no está disponible en el idioma seleccionado.
Chapter 4. Quick start
Prerequisites
-
You have access to an OpenShift Container Platform cluster with
cluster-adminpermissions. -
You have installed the OpenShift CLI (
oc). - You have access to a supported object store. For example, AWS S3, Google Cloud Storage, Azure, Swift, Minio, or OpenShift Data Foundation.
Procedure
-
Install the
Red Hat OpenShift Logging Operator,Loki Operator, andCluster Observability Operator (COO)from OperatorHub. Create a secret to access an existing object storage bucket:
Example command for AWS
$ oc create secret generic logging-loki-s3 \ --from-literal=bucketnames="<bucket_name>" \ --from-literal=endpoint="<aws_bucket_endpoint>" \ --from-literal=access_key_id="<aws_access_key_id>" \ --from-literal=access_key_secret="<aws_access_key_secret>" \ --from-literal=region="<aws_region_of_your_bucket>" \ -n openshift-loggingCreate a
LokiStackcustom resource (CR) in theopenshift-loggingnamespace:apiVersion: loki.grafana.com/v1 kind: LokiStack metadata: name: logging-loki namespace: openshift-logging spec: managementState: Managed size: 1x.extra-small storage: schemas: - effectiveDate: '2022-06-01' version: v13 secret: name: logging-loki-s3 type: s3 storageClassName: gp3-csi tenants: mode: openshift-loggingCreate a service account for the collector:
$ oc create sa collector -n openshift-loggingBind the
ClusterRoleto the service account:$ oc adm policy add-cluster-role-to-user logging-collector-logs-writer -z collector -n openshift-loggingCreate a
UIPluginto enable the Log section in the Observe tab:apiVersion: observability.openshift.io/v1alpha1 kind: UIPlugin metadata: name: logging spec: type: Logging logging: lokiStack: name: logging-lokiAdd additional roles to the collector service account:
$ oc adm policy add-cluster-role-to-user collect-application-logs -z collector -n openshift-logging$ oc adm policy add-cluster-role-to-user collect-audit-logs -z collector -n openshift-logging$ oc adm policy add-cluster-role-to-user collect-infrastructure-logs -z collector -n openshift-loggingCreate a
ClusterLogForwarderCR to configure log forwarding:apiVersion: observability.openshift.io/v1 kind: ClusterLogForwarder metadata: name: collector namespace: openshift-logging spec: serviceAccount: name: collector outputs: - name: default-lokistack type: lokiStack lokiStack: target: name: logging-loki namespace: openshift-logging authentication: token: from: serviceAccount tls: ca: key: service-ca.crt configMapName: openshift-service-ca.crt pipelines: - name: default-logstore inputRefs: - application - infrastructure outputRefs: - default-lokistack
Verification
- Verify that logs are visible in the Log section of the Observe tab in the OpenShift Container Platform web console.