Helmチャートを使用してロギング・エージェントをデプロイするテンプレート
Red Hat OpenShift on IBM Cloud (OpenShift )クラスタまたは Kubernetes クラスタから IBM Cloud Logs インスタンスにインフラストラクチャとアプリケーションのログを収集し、ルーティングするために ロギング・エージェント をデプロイするために Helm チャートを使用することができます。
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
Kubernetesクラスタ上で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 ファイルで設定できるパラメータのリストである:
| パラメーター | 説明 | ステータス | デフォルト値 |
|---|---|---|---|
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環境で使用されるホスト名。 | iamEnviroment が Custom に設定されている場合は必要です。 |
デフォルト値なし |
secret.iamAPIKey |
APIKeyのID。 この値はCLIを通じてのみ提供する必要がある。 詳細については、env.iamModeを参照してください。 |
この iamMode=IAMAPIKey は |
デフォルト値なし |
clusterName |
kubernetesクラスタの名前 | オプション | デフォルト値なし |
scc.create |
OpenshiftでSecure Context Constraintsを作成するタイミングを示します | Openshiftクラスタのデプロイにのみ必要です。 | false |
defaultMetadata.subsystemName |
IBM Cloud Logsの subsystemNameをオーバーライドする静的文字列 | オプション | デフォルト値は、ログを生成した名前空間に設定される |
defaultMetadata.applicationName |
IBM Cloud Logsの applicationNameをオーバーライドする静的文字列 | オプション | デフォルト値は、ログを生成したコンテナ名に設定される |
resources |
logs-agentに割り当てられたkubernetesリソースをオーバーライドする | オプション | デフォルト値は リソース を参照 |
additionalLogSourcePaths |
The path of additional logs beyond the default. /var/log/containers/*.log For more information, see ログソースパスの設定. |
オプション | デフォルト値なし |
excludeLogSourcePaths |
エージェントが収集すべきでない追加ログのパス 詳細については、 ログソースパスの設定 を参照してください。 |
オプション | デフォルト値なし |
selectedLogSourcePaths |
エージェントが収集するログのパス。デフォルトパスと additionalLogSourcePathsで設定されたファイルは除く 詳細については、ログソースパスの設定 を参照してください。 |
オプション | デフォルト値なし |
includeAnnotations |
コンテナ注釈をログメッセージ に含めるように kubernetes プラグインに指示します。 詳細は、[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 APIKeyまたはTrusted Profileの設定を選択できます。
- 有効な値は、
TrustedProfileまたはIAMAPIKey - デフォルト値はTrusted Profile構成である。
ファイルのエントリーは以下のようになる logs-values.yaml
env:
iamMode: IAMAPIKey
このパラメータを設定する際には、以下の情報を考慮してください:
-
env.iamMode: "TrustedProfile"設定されている場合、env.trustedProfileID変数も提供されなければならない。 -
env.iamMode: "IAMAPIKey"セットされている場合、コンフィギュレーションは、パーミッションを持つIAM Apikeyを含むシークレットが定義されていることを期待します。helmコマンドで
secret.iamAPIKey変数が提供された場合(例えば--set secret.iamAPIKey=<your iamAPIKey>)、helmチャートは 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: ""
resources
このセクションでは、ロギング・エージェントコンテナに割り当てられているリソースを変更することができます。
ファイルのエントリーは以下のようになり、以下のデフォルト値が設定される 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です。
有効な値は :
iam.cloud.ibm.comデフォルトのエンドポイントを使用するようにProductionを設定するprivate.iam.cloud.ibm.comエンドポイントを使用するようにPrivateProductionを設定する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 です。
詳細については、この値を設定することの意味を理解するために、再試行に関するFluentbitのドキュメント を参照してください。
状況によっては、この設定は、送信できないためにエージェントによってログデータが廃棄されることにつながる。
ファイルのエントリーは以下のようになる 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"
}
}