検索

8.2. ログ転送カスタムリソースの更新

download PDF

OpenShift Container Platform 4.6 では、OpenShift Container Platform ログ転送 API はテクノロジープレビューから一般利用が可能となりました。GA リリースには、ClusterLogging カスタムリソース (CR) に変更を加え、LogForwarding カスタムリソース (CR) を ClusterLogForwarder CR に置き換える必要がある改善点および機能拡張が含まれています。

OpenShift Container Platform 4.6 の ClusterLogForwarder インスタンスのサンプル

apiVersion: logging.openshift.io/v1
kind: ClusterLogForwarder
metadata:
  name: instance
  namespace: openshift-logging
....
spec:
  outputs:
  - url: http://remote.elasticsearch.com:9200
    name: elasticsearch
    type: elasticsearch
  - url: tls://fluentdserver.example.com:24224
    name: fluentd
    type: fluentdForward
    secret:
      name: fluentdserver
  pipelines:
  - inputRefs:
      - infrastructure
      - application
    name: mylogs
    outputRefs:
     - elasticsearch
  - inputRefs:
      - audit
    name: auditlogs
    outputRefs:
      - fluentd
      - default
...

OpenShift Container Platform 4.5 の ClusterLogForwarder CR のサンプル

apiVersion: logging.openshift.io/v1alpha1
kind: LogForwarding
metadata:
  name: instance
  namespace: openshift-logging
spec:
  disableDefaultForwarding: true
  outputs:
   - name: elasticsearch
     type: elasticsearch
     endpoint: remote.elasticsearch.com:9200
   - name: fluentd
     type: forward
     endpoint: fluentdserver.example.com:24224
     secret:
       name: fluentdserver
  pipelines:
   - inputSource: logs.infra
     name: infra-logs
     outputRefs:
     - elasticearch
   - inputSource: logs.app
     name: app-logs
     outputRefs:
      -  elasticearch
   - inputSource: logs.audit
     name: audit-logs
     outputRefs:
      -  fluentd

以下の手順では、変更が必要な各パラメーターを示しています。

手順

4.5 の ClusterLogForwarder CR を 4.6 の ClusterLogForwarding に更新するには、以下の変更を行います。

  1. ClusterLogging カスタムリソース (CR) を編集して logforwardingtechpreview アノテーションを削除します。

    ClusterLogging CR の例

    apiVersion: "logging.openshift.io/v1"
    kind: "ClusterLogging"
    metadata:
      annotations:
        clusterlogging.openshift.io/logforwardingtechpreview: enabled 1
      name: "instance"
      namespace: "openshift-logging"
    ....

    1
    logforwardingtechpreview アノテーションを削除します。
  2. ClusterLogForwarder CR をエクスポートし、ClusterLogForwarder インスタンスの YAML ファイルを作成します。

    $ oc get LogForwarding instance -n openshift-logging -o yaml| tee ClusterLogForwarder.yaml
  3. YAML ファイルを編集して以下の変更を加えます。

    OpenShift Container Platform 4.6 の ClusterLogForwarder インスタンスのサンプル

    apiVersion: logging.openshift.io/v1 1
    kind: ClusterLogForwarder 2
    metadata:
      name: instance
      namespace: openshift-logging
    ....
    spec: 3
      outputs:
      - url: http://remote.elasticsearch.com:9200 4
        name: elasticsearch
        type: elasticsearch
      - url: tls://fluentdserver.example.com:24224
        name: fluentd
        type: fluentdForward 5
        secret:
          name: fluentdserver
      pipelines:
      - inputRefs: 6
          - infrastructure
          - application
        name: mylogs
        outputRefs:
         - elasticsearch
      - inputRefs:
          - audit
        name: auditlogs
        outputRefs:
          - fluentd
          - default 7
    ...

    1
    apiVersion"logging.openshift.io/v1alpha1" から "logging.openshift.io/v1" に変更します。
    2
    オブジェクトの種類を kind: "LogForwarding" から kind: "ClusterLogForwarder" に変更します。
    3
    disableDefaultForwarding: true パラメーターを削除します。
    4
    output パラメーターを spec.outputs.endpoint から spec.outputs.url に変更します。接頭辞がない場合は、https://tcp:// など、URL に接頭辞を追加します。
    5
    Fluentd 出力の場合は、typeforward から fluentdForward に変更します。
    6
    Pipeline を変更します。
    • spec.pipelines.inputSourcespec.pipelines.inputRefs に変更します。
    • logs.infrainfrastructure に変更します。
    • logs.appapplication に変更します。
    • logs.auditaudit に変更します。
    7
    オプション: ログを内部 Elasticsearch インスタンスに送信するために default のパイプラインを追加します。default の出力を設定する必要はありません。
    注記

    ログを内部の OpenShift Container Platform Elasticsearch インスタンスのみに転送する必要がある場合は、ログ転送 API を設定しないようにしてください。

  4. CR オブジェクトを作成します。

    $ oc create -f ClusterLogForwarder.yaml

ログ転送 API の新機能の詳細は、ログのサードパーティーシステムへの転送 を参照してください。

Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.