Vorlage für den Einsatz des Protokollierungsagent unter Verwendung einer Helm-Karte

Sie können ein Helm Diagramm verwenden, um Protokollierungsagent zum Sammeln und Weiterleiten von Infrastruktur- und Anwendungsprotokollen von einem Red Hat OpenShift on IBM Cloud (OpenShift) Cluster oder einem Kubernetes Cluster zu einer IBM Cloud Logs Instanz einzusetzen.

Vorlage für die Bereitstellung des Protokollierungsagent mit einem Helm-Diagramm auf einem Openshift-Cluster

metadata:
  name: "logs-agent"
image:
  version: "1.3.0"  # required

clusterName: ""     # Enter the name of your cluster. This information is used to improve the metadata and help with your filtering.

env:
  # ingestionHost is a required field. For example:
  # ingestionHost: "<logs instance>.ingress.us-east.logs.cloud.ibm.com"
  ingestionHost: "" # required

  # If you are using private CSE proxy, then use port number "3443"
  # If you are using private VPE Gateway, then use port number "443"
  # If you are using the public endpoint, then use port number "443"
  ingestionPort: "" # required

  iamMode: "TrustedProfile"
  # trustedProfileID - trusted profile id - required if iamMode is set to "TrustedProfile"
  trustedProfileID: ""

  # Configure this parameter to control the IAM endpoint used by the agent to exchange the tokens.
  # If omitted, the default value is "Production".
  # Valid values are :
  # "Production" to use the iam.cloud.ibm.com default endpoint
  # "PrivateProduction" to use the private.iam.cloud.ibm.com endpoint
  # "Custom" to use a custom provided IAM endpoint
  iamEnvironment: "Production"
  # iamHost - custom IAM endpoint (for example: private.eu-de.iam.cloud.ibm.com) - required if iamEnvironment is set to "Custom"
  iamHost: ""

scc:
  # true enables creation of Security Context Constraints in Openshift clusters
  create: true

defaultMetadata:
  # Configure to override the default subsystemName and applicationName that are used in the environment.
  subsystemName: ""  # The default value is set to the namespace that generated the log
  applicationName: ""  # The default value is set to the container name that generated the log

resources:
  # Configure this section to change the resources that are assigned to the agent container.
  limits:
    cpu: 500m
    ephemeral_storage: 10Gi
    memory: 3Gi
  requests:
    cpu: 100m
    ephemeral_storage: 2Gi
    memory: 1Gi

# Configure these parameters to include, exclude or restrict the set of logs that are processed by the agent
# By default, the agent will collect the logs from `/var/log/containers/*.log`.
# Each field is set as comma separated list, for example “/var/log/abc/*.log,/var/log/xyz/*.log”
additionalLogSourcePaths: "" # adds locations to the default set of logs that will be processed.
excludeLogSourcePaths: "" # ignores logs in the specified locations.
selectedLogSourcePaths: ""  # overrides the default path `/var/log/containers/*.log` and ignores the `additionalLogSourcePaths` configurations

# Configure this parameter to change the setting for the Kubernetes filter to include the annotations from Kubernetes with the log records.
# The default value for this setting is `false`.
includeAnnotations: true

# Configure this parameter to control the number of times the agent will retry sending data if an error occurs that is considered to be retryable.
# The default is `False`.
# For more information, see the [Fluentbit documentation about retries](https://docs.fluentbit.io/manual/administration/scheduling-and-retries) to understand the implications of setting this value.
retryLimit: False

# Configure additional tags as key/value pair tags that can be added as metadata to every log line.
additionalMetadata:
#  region: ca-tor
#  env: production

# Configure the level of logging
# Default value is info
# Valid values are: debug, info, or error
loggingLevel: info

Vorlage für die Bereitstellung des Protokollierungsagent unter Verwendung eines Helm-Charts auf einem Kubernetes-Cluster

metadata:
  name: "logs-agent"
image:
  version: "1.3.0"  # required

clusterName: ""     # Enter the name of your cluster. This information is used to improve the metadata and help with your filtering.

env:
  # ingestionHost is a required field. For example:
  # ingestionHost: "<logs instance>.ingress.us-east.logs.cloud.ibm.com"
  ingestionHost: "" # required

  # If you are using private CSE proxy, then use port number "3443"
  # If you are using private VPE Gateway, then use port number "443"
  # If you are using the public endpoint, then use port number "443"
  ingestionPort: "" # required

  iamMode: "TrustedProfile"
  # trustedProfileID - trusted profile id - required for iam trusted profile mode
  trustedProfileID: "" # required if iamMode is set to TrustedProfile

  # Configure this parameter to control the IAM endpoint used by the agent to exchange the tokens.
  # If omitted, the default value is "Production".
  # Valid values are :
  # "Production" to use the iam.cloud.ibm.com default endpoint
  # "PrivateProduction" to use the private.iam.cloud.ibm.com endpoint
  # "Custom" to use a custom provided IAM endpoint
  iamEnvironment: "Production"
  # iamHost - custom IAM endpoint (for example: private.eu-de.iam.cloud.ibm.com) - required if iamEnvironment is set to "Custom"
  iamHost: ""

scc:
  # true enables creation of Security Context Constraints in Openshift clusters
  # set to false for Kubernetes clusters
  create: false

defaultMetadata:
  # Configure to override the default subsystemName and applicationName that are used in the environment.
  subsystemName: ""  # The default value is set to the namespace that generated the log
  applicationName: ""  # The default value is set to the container name that generated the log

resources:
  # Configure this section to change the resources that are assigned to the agent container.
  limits:
    cpu: 500m
    ephemeral_storage: 10Gi
    memory: 3Gi
  requests:
    cpu: 100m
    ephemeral_storage: 2Gi
    memory: 1Gi

# Configure these parameters to include, exclude or restrict the set of logs that are processed by the agent
# By default, the agent will collect the logs from `/var/log/containers/*.log`.
# Each field is set as comma separated list, for example “/var/log/abc/*.log,/var/log/xyz/*.log”
additionalLogSourcePaths: "" # adds locations to the default set of logs that will be processed.
excludeLogSourcePaths: "" # ignores logs in the specified locations.
selectedLogSourcePaths: ""  # overrides the default path `/var/log/containers/*.log` and ignores the `additionalLogSourcePaths` configurations

# Configure this parameter to change the setting for the Kubernetes filter to include the annotations from Kubernetes with the log records.
# The default value for this setting is `false`.
includeAnnotations: true

# Configure this parameter to control the number of times the agent will retry sending data if an error occurs that is considered to be retryable.
# The default is `False`.
# For more information, see the [Fluentbit documentation about retries](https://docs.fluentbit.io/manual/administration/scheduling-and-retries) to understand the implications of setting this value.
retryLimit: False

# Configure additional tags as key/value pair tags that can be added as metadata to every log line.
additionalMetadata:
#  region: ca-tor
#  env: production

# Configure the level of logging
# Default value is info
# Valid values are: debug, info, or error
loggingLevel: info

Helm Optionen für die Diagrammkonfiguration

Die folgende Tabelle enthält eine Liste der Parameter, die Sie in der logs-values.yaml-Datei konfigurieren können, um die Protokollierungsagent-Konfigurationen anzupassen:

Parameter derHelm
Parameter Beschreibung Status Standardwert
metadata.name Der Name des Agenten, der für alle Kubernetes Ressourcen verwendet wird Erforderlich logs-agent
image.version Die Version des Container-Images des Agenten (z. B. 1.3.0) Erforderlich Kein Standardwert
env.ingestionHost Der IBM Cloud Logs Host, an den die Protokolle gesendet werden sollen Erforderlich Kein Standardwert
env.ingestionPort Der IBM Cloud Logs Port, an den die Protokolle gesendet werden Erforderlich Kein Standardwert
env.iamMode Geben Sie den verwendeten IAM-Authentifizierungsmechanismus an. Gültige Werte sind: TrustedProfile oder IAMAPIKey Erforderlich TrustedProfile
env.trustedProfileID Die vertrauenswürdige Profil-ID. Dieser Parameter ist erforderlich, wenn iamMode=TrustedProfile Kein Standardwert
env.iamEnvironment Steuert den IAM-Endpunkt, der vom Agenten zum Austausch der Token verwendet wird.
Weitere Informationen finden Sie unter iamEnvironment.
Erforderlich Production
env.iamHost Hostname, der für die benutzerdefinierte IAM-Umgebung verwendet wird. Erforderlich, wenn iamEnviroment auf Custom gesetzt ist. Kein Standardwert
secret.iamAPIKey Die APIKey-ID. Sie sollten diesen Wert nur über die Befehlszeilenschnittstelle angeben. Weitere Informationen finden Sie unter env.iamMode. Dieser Parameter ist erforderlich, wenn iamMode=IAMAPIKey Kein Standardwert
clusterName Der Name des Kubernetes-Clusters Optionale Kein Standardwert
scc.create Gibt an, wann die Secure Context Constraints in Openshift erstellt werden sollen Nur für Openshift-Cluster-Bereitstellungen erforderlich. false
defaultMetadata.subsystemName Statische Zeichenfolge, die den subsystemName in IBM Cloud Logs überschreibt Optionale Der Standardwert ist auf den Namespace gesetzt, der das Protokoll erzeugt hat
defaultMetadata.applicationName Statische Zeichenkette zum Überschreiben des applicationName in IBM Cloud Logs Optionale Der Standardwert ist auf den Containernamen eingestellt, der das Protokoll erzeugt hat
resources Überschreiben Sie die dem Logs-Agenten zugewiesenen Kubernetes-Ressourcen Optionale Siehe Ressourcen, um die Standardwerte zu sehen
additionalLogSourcePaths Der Pfad der zusätzlichen Logs über den Standard hinaus. /var/log/containers/*.log
Weitere Informationen finden Sie unter Konfigurationen der Protokollquellenpfade.
Optionale Kein Standardwert
excludeLogSourcePaths Der Pfad der zusätzlichen Protokolle, die nicht vom Agenten gesammelt werden sollen.
Weitere Informationen finden Sie unter Konfigurationen der Protokollquellenpfade.
Optionale Kein Standardwert
selectedLogSourcePaths Der Pfad der Protokolle, die vom Agenten gesammelt werden, mit Ausnahme des Standardpfads und der in additionalLogSourcePaths konfigurierten Dateien.
Weitere Informationen finden Sie unter Konfigurationen der Protokollquellenpfade.
Optionale Kein Standardwert
includeAnnotations Weisen Sie das Kubernetes-Plugin an, die Container-Annotationen mit den Protokollmeldungen
einzuschließen. Weitere Informationen finden Sie unter [includeAnnotations#agent-helm-template-clusters-chart-options-include-annotations]).
Erforderlich false
retryLimit Begrenzung der Anzahl der Wiederholungsversuche
Für weitere Informationen siehe retryLimit
Erforderlich Falsch
loggingLevel Die Art der Protokolle, die vom Agenten selbst gemeldet werden sollen. Gültige Werte sind: debug, info, oder error. Erforderlich info
additionalMetadata Eine Liste von Schlüssel/Wertpaaren, die als Metadaten zu jeder Protokollzeile hinzugefügt werden können.
Weitere Informationen finden Sie unter additionalMetadata.
Optionale Kein Standardwert

env.iamMode

Konfigurieren Sie diesen Parameter, um die Authentifizierungsmethode auszuwählen, die der Agent beim Senden von Protokollen an eine IBM Cloud Logs-Instanz verwenden soll.

  • Sie können einen IAM APIKey oder eine vertrauenswürdige Profilkonfiguration wählen.
  • Gültige Werte sind: TrustedProfile oder IAMAPIKey
  • Der Standardwert ist eine vertrauenswürdige Profilkonfiguration.

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus:

env:
  iamMode: IAMAPIKey

Beachten Sie bei der Einstellung dieses Parameters die folgenden Informationen:

  • Wenn env.iamMode: "TrustedProfile" gesetzt ist, muss auch die Variable env.trustedProfileID angegeben werden.

  • Wenn env.iamMode: "IAMAPIKey" gesetzt ist, erwartet die Konfiguration, dass ein Geheimnis definiert wird, das einen IAM Apikey mit Berechtigungen enthält.

    Wenn die Variable secret.iamAPIKey im Helm-Befehl angegeben wird (z. B. --set secret.iamAPIKey=<your iamAPIKey>), erstellt die Helm-Grafik das Geheimnis Kubernetes.

    Alternativ können Sie das Geheimnis auch im Voraus mit dem Befehl erstellen: (Stellen Sie sicher, dass Sie mit Ihrem Cluster verbunden sind.)

    kubectl create secret generic <helm install-name> -n ibm-observe --from-literal=IAM_API_KEY=<apikey>
    

defaultMetadata

In diesem Abschnitt kann der Benutzer die Standardwerte subsystemName und applicationName, die in der Umgebung verwendet werden, außer Kraft setzen. Standardmäßig sind die Werte nicht festgelegt, und das Ausgabe-Plugin setzt die Werte dynamisch auf:

  • subsystemName: der Kubernetes-Namensraum, der das Protokoll erzeugt hat
  • applicationName: der Containername, der das Protokoll erzeugt hat

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus:

defaultMetadata:
  subsystemName: ""
  applicationName: ""

Ressourcen

In diesem Abschnitt kann der Benutzer die Ressourcen ändern, die dem Container Protokollierungsagent zugeordnet sind.

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus und setzt die folgenden Standardwerte:

resources:
  limits:
    cpu: 500m
    ephemeral_storage: 10Gi
    memory: 3Gi
  requests:
    cpu: 100m
    ephemeral_storage: 2Gi
    memory: 1Gi

Wenn Sie einen der Werte aktualisieren müssen, muss die gesamte Konfiguration angegeben werden, auch wenn Sie nicht alle Werte aktualisieren.

Konfigurationen der Log Source Paths

Standardmäßig sammelt der Agent die Protokolle von /var/log/containers/*.log.

Die folgenden zusätzlichen Variablen können angegeben werden, um die Menge der zu verarbeitenden Protokolle einzuschließen, auszuschließen oder einzuschränken:

  • additionalLogSourcePaths fügt dem Standardsatz von Protokollen, die verarbeitet werden, Standorte hinzu.
  • excludeLogSourcePaths ignoriert Protokolle an den angegebenen Orten.
  • selectedLogSourcePaths setzt den Standardpfad /var/log/containers/*.log außer Kraft und ignoriert die additionalLogSourcePaths-Konfigurationen. Nur die Dateien, die über diesen Parameter eingestellt sind, werden vom Agenten erfasst.

Sie können mehrere Pfade definieren, indem Sie eine durch Komma getrennte Liste verwenden, zum Beispiel "/var/log/abc/.log,/var/log/xyz/.log".

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus:

# comma separated list, for example “/var/log/abc/*.log,/var/log/xyz/*.log”
additionalLogSourcePaths: ""
excludeLogSourcePaths: ""
selectedLogSourcePaths: ""

env.iamEnvironment

Diese Konfiguration steuert den IAM-Endpunkt, der vom Agenten zum Austausch der Token verwendet wird.

Der Standardwert ist Production.

Gültige Werte sind:

  • Setzen Sie Production, um den iam.cloud.ibm.com Standard-Endpunkt zu verwenden
  • Legen Sie PrivateProduction fest, um den Endpunkt private.iam.cloud.ibm.com zu verwenden
  • Legen Sie Custom fest, um einen benutzerdefinierten IAM-Endpunkt zu verwenden (z. B. private.eu-de.iam.cloud.ibm.com )

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus:

env:
  iamEnvironment: "Production"

Für die Einstellung Custom iamEnvironment muss auch iamHost angegeben werden.

env:
  iamEnvironment: "Custom"
  iamHost: "private.eu-de.iam.cloud.ibm.com"

includeAnnotations

Diese Konfiguration ändert die Einstellung für den Kubernetes-Filter, um die Anmerkungen von Kubernetes in die Protokolleinträge aufzunehmen.

Der Standardwert für diese Einstellung ist false.

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus:

includeAnnotations: true

retryLimit

Diese Konfiguration legt fest, wie oft der Agent das Senden von Daten wiederholt, wenn ein Fehler auftritt, der als wiederholbar angesehen wird.

Der Standardwert ist False.

Weitere Informationen finden Sie in der Fluentbit-Dokumentation über Wiederholungen, um die Auswirkungen der Einstellung dieses Wertes zu verstehen.

In manchen Situationen kann diese Einstellung dazu führen, dass Protokolldaten vom Agenten verworfen werden, weil sie nicht gesendet werden können.

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus:

retryLimit: 8

additionalMetadata

Dies ist eine Liste von Schlüssel/Wertpaaren, die unter dem meta-Objekt hinzugefügt werden, um zusätzliche Tags zu ermöglichen.

Der Eintrag in der Datei logs-values.yaml sieht wie folgt aus:

additionalMetadata:
  region: ca-tor
  env: production

Das obige Beispiel führt dazu, dass jeder Protokollzeile in IBM Cloud Logs die folgenden zusätzlichen Felder hinzugefügt werden:

{
  "meta": {
    "region": "ca-tor",
    "env": "production"
  }
}