로깅 에이전트 차트를 사용하여 Helm 배포 템플릿

Helm 차트를 사용하여 로깅 에이전트 을 배포하여 Red Hat OpenShift on IBM Cloud (OpenShift) 클러스터 또는 Kubernetes 클러스터에서 IBM Cloud Logs 인스턴스로 인프라 및 애플리케이션 로그를 수집하고 라우팅할 수 있습니다.

로깅 에이전트 차트를 사용하여 Openshift 클러스터에 Helm 배포 템플릿

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

로깅 에이전트 차트를 사용하여 Helm 클러스터에 배포하기 위한 템플릿

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 차트 구성 옵션

다음 표에는 logs-values.yaml 파일에서 구성할 수 있는 매개변수 목록이 포함되어 있어 로깅 에이전트 구성을 조정할 수 있습니다:

Helm 차트 매개변수
매개변수 설명 상태 기본값
metadata.name 모든 Kubernetes 리소스에 사용되는 에이전트의 이름이다 필수 logs-agent
image.version 상담원 컨테이너 이미지의 버전(예: 1.3.0) 필수 기본값 없음
env.ingestionHost 로그를 전송할 IBM Cloud Logs 호스트 필수 기본값 없음
env.ingestionPort 로그를 전송할 IBM Cloud Logs 포트입니다 필수 기본값 없음
env.iamMode 사용된 IAM 인증 메커니즘을 표시합니다. 유효한 값은 다음과 같습니다: TrustedProfile 또는 IAMAPIKey 입니다 필수 TrustedProfile
env.trustedProfileID 신뢰할 수 있는 프로필 ID입니다. 이 매개 변수는 iamMode=TrustedProfile 인 경우에 필요합니다 기본값 없음
env.iamEnvironment 에이전트가 토큰을 교환하는 데 사용하는 IAM 엔드포인트를 제어합니다.
자세한 내용은 iamEnvironment 을 참조하세요.
필수 Production
env.iamHost 사용자 지정 IAM 환경에 사용되는 호스트 이름입니다. iamEnviromentCustom 로 설정된 경우 필요합니다. 기본값 없음
secret.iamAPIKey API키 ID입니다. 이 값은 CLI를 통해서만 제공해야 합니다. 추가 정보는 env.iamMode의 내용을 참조하십시오. 이 매개 변수는 iamMode=IAMAPIKey 인 경우에 필요합니다 기본값 없음
clusterName 쿠버네티스 클러스터의 이름 선택사항 기본값 없음
scc.create Openshift에서 보안 컨텍스트 제약 조건을 생성할 시기를 나타냅니다 Openshift 클러스터 배포에만 필요합니다. false
defaultMetadata.subsystemName IBM Cloud Logs에서 subsystemName을 재정의하는 정적 문자열 선택사항 기본값은 로그를 생성한 네임스페이스로 설정됩니다
defaultMetadata.applicationName IBM Cloud Logs에서 applicationName을 재정의하는 정적 문자열 선택사항 기본값은 로그를 생성한 컨테이너 이름으로 설정됩니다
resources 로그 에이전트에 할당된 쿠버네티스 리소스를 재정의한다 선택사항 기본값을 확인하려면 리소스 를 참조하세요
additionalLogSourcePaths 기본값 이외의 추가 로그 경로입니다. /var/log/containers/*.log
자세한 내용은 로그 소스 경로 구성 를 참조하세요.
선택사항 기본값 없음
excludeLogSourcePaths 상담원이 수집해서는 안 되는 추가 로그의 경로입니다.
자세한 내용은 로그 소스 경로 구성 를 참조하세요.
선택사항 기본값 없음
selectedLogSourcePaths 에이전트가 수집하는 로그의 경로(기본 경로 및 additionalLogSourcePaths 에 구성된 모든 파일 제외).
자세한 내용은 로그 소스 경로 구성 를 참조하세요.
선택사항 기본값 없음
includeAnnotations 로그 메시지와 함께 컨테이너 주석을 포함하도록 쿠버네티스 플러그인에 지시하세요(자세한 내용은 [includeAnnotations#agent-helm-template-clusters-chart-options-include-annotations를] 참조하세요). 필수 false
retryLimit 재시도 횟수 제한
자세한 내용은 retryLimit 을 참조하세요
필수 거짓
loggingLevel 상담원 자체에서 보고해야 하는 로그 유형입니다. 유효한 값은 다음과 같습니다: debug, info 또는 error 입니다. 필수 info
additionalMetadata 모든 로그 행에 메타데이터로 추가할 수 있는 키/값 쌍 태그의 목록입니다.
자세한 내용은 additionalMetadata 를 참조하세요.
선택사항 기본값 없음

env.iamMode

이 매개 변수를 구성하여 에이전트가 로그를 IBM Cloud Logs 인스턴스로 전송할 때 사용할 인증 방법을 선택합니다.

  • IAM API키 또는 신뢰할 수 있는 프로필 구성을 선택할 수 있습니다.
  • 유효한 값은 다음과 같습니다: TrustedProfile 또는 IAMAPIKey 입니다
  • 기본값은 신뢰할 수 있는 프로필 구성입니다.

logs-values.yaml 파일의 항목은 다음과 같습니다:

env:
  iamMode: IAMAPIKey

이 매개변수를 설정할 때 다음 정보를 고려하세요:

  • env.iamMode: "TrustedProfile" 이 설정되어 있는 경우 env.trustedProfileID 변수도 제공해야 합니다.

  • env.iamMode: "IAMAPIKey" 이 설정된 경우, 구성은 권한이 있는 IAM Apikey를 포함하는 비밀을 정의할 것으로 예상합니다.

    헬름 명령에 secret.iamAPIKey 변수가 제공되면(예: --set secret.iamAPIKey=<your iamAPIKey>), 헬름 차트가 Kubernetes 시크릿을 생성합니다.

    또는 다음 명령을 사용하여 미리 비밀을 만들 수도 있습니다: (클러스터에 연결되어 있는지 확인하세요.)

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

defaultMetadata

이 섹션에서는 사용자가 환경에서 사용되는 기본 subsystemName 및 applicationName을 재정의할 수 있습니다. 기본적으로 값은 설정되어 있지 않으며 출력 플러그인이 값을 동적으로 설정합니다:

  • subsystemName: 로그를 생성한 Kubernetes 네임스페이스를 입력한다
  • applicationName: 로그를 생성한 컨테이너 이름입니다

logs-values.yaml 파일의 항목은 다음과 같습니다:

defaultMetadata:
  subsystemName: ""
  applicationName: ""

리소스

이 섹션에서는 사용자가 로깅 에이전트 컨테이너에 할당되는 리소스를 변경할 수 있습니다.

logs-values.yaml 파일의 항목은 다음과 같으며 다음과 같은 기본값을 설정합니다:

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

값을 업데이트해야 하는 경우 모든 값을 업데이트하지 않더라도 전체 구성을 제공해야 합니다.

로그 소스 경로 구성

기본적으로 에이전트는 /var/log/containers/*.log 에서 로그를 수집합니다.

처리할 로그 집합을 포함, 제외 또는 제한하기 위해 다음과 같은 추가 변수를 제공할 수 있습니다:

  • additionalLogSourcePaths 은 처리할 기본 로그 집합에 위치를 추가합니다.
  • excludeLogSourcePaths 지정된 위치의 로그를 무시합니다.
  • selectedLogSourcePaths 은 기본 경로인 /var/log/containers/*.log 를 재정의하고 additionalLogSourcePaths 구성을 무시합니다. 이 매개 변수를 통해 설정된 파일만 에이전트가 수집합니다.

쉼표로 구분된 목록을 사용하여 여러 경로를 정의할 수 있습니다(예: "/var/log/abc/.log,/var/log/xyz/.log").

logs-values.yaml 파일의 항목은 다음과 같습니다:

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

env.iamEnvironment

이 구성은 에이전트가 토큰을 교환하는 데 사용하는 IAM 엔드포인트를 제어합니다.

기본값은 Production입니다.

유효한 값은 :

  • Production 기본 엔드포인트를 사용하도록 iam.cloud.ibm.com 를 설정합니다
  • PrivateProduction 엔드포인트를 사용하도록 private.iam.cloud.ibm.com 를 설정합니다
  • Custom 를 사용자 지정 IAM 엔드포인트(예: private.eu-de.iam.cloud.ibm.com )를 사용하도록 설정합니다

logs-values.yaml 파일의 항목은 다음과 같습니다:

env:
  iamEnvironment: "Production"

Custom iamEnvironment 설정을 위해서는 iamHost 도 제공되어야 합니다.

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

includeAnnotations

이 구성은 로그 레코드와 함께 Kubernetes의 주석을 포함하도록 Kubernetes 필터의 설정을 변경합니다.

이 설정의 기본값은 false 입니다.

logs-values.yaml 파일의 항목은 다음과 같습니다:

includeAnnotations: true

retryLimit

이 구성은 재시도 가능한 것으로 간주되는 오류가 발생할 경우 상담원이 데이터 전송을 다시 시도하는 횟수를 제한합니다.

기본값은 False입니다.

자세한 내용은 이 값 설정의 의미를 이해하려면 재시도에 관한 플루언트비트 문서 을 참조하세요.

일부 상황에서는 이 설정으로 인해 에이전트가 전송할 수 없어 로그 데이터가 삭제될 수 있습니다.

logs-values.yaml 파일의 항목은 다음과 같습니다:

retryLimit: 8

additionalMetadata

추가 태그를 허용하기 위해 meta 개체 아래에 추가될 키/값 쌍의 목록입니다.

logs-values.yaml 파일의 항목은 다음과 같습니다:

additionalMetadata:
  region: ca-tor
  env: production

위의 예제에서는 IBM Cloud Logs의 각 로그 행에 다음과 같은 추가 필드가 추가됩니다:

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