Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

36.5.5.2. Curator 設定の作成

openshift_logging Ansible ロールは、Curator が設定の読み取りに使用する ConfigMap を提供します。この ConfigMap を編集するか、または置き換えることで、Curator を再設定することができます。現時点で、Ops および非 Ops 両方の Curator インスタンスを設定するために logging-curator ConfigMap が使用されています。.operations 設定はすべてアプリケーションログ設定と同じ場所にあります。

  1. Curator 設定ファイルを作成するには、デプロイされた ConfigMap で設定を編集します。

    $ oc edit configmap/logging-curator

    または cronjob からジョブを手動で作成します。

    oc create job --from=cronjob/logging-curator <job_name>
    • スクリプト化されたデプロイメントの場合、インストーラーによって作成された設定ファイルをコピーし、新規の OpenShift Container Platform カスタム設定を作成します。

      $ oc extract configmap/logging-curator --keys=curator5.yaml,config.yaml --to=/my/config
        edit /my/config/curator5.yaml
        edit /my/config/config.yaml
      $ oc delete configmap logging-curator ; sleep 1
      $ oc create configmap logging-curator \
          --from-file=curator5.yaml=/my/config/curator5.yaml \
          --from-file=config.yaml=/my/config/config.yaml \
          ; sleep 1
    • または、Actions File を使用している場合は、以下を実行します。

      $ oc extract configmap/logging-curator --keys=curator5.yaml,actions.yaml --to=/my/config
        edit /my/config/curator5.yaml
        edit /my/config/actions.yaml
      $ oc delete configmap logging-curator ; sleep 1
      $ oc create configmap logging-curator \
          --from-file=curator5.yaml=/my/config/curator5.yaml \
          --from-file=actions.yaml=/my/config/actions.yaml \
          ; sleep 1

次にスケジュールされたジョブがこの設定を使用します。

以下のコマンドを用して cronjob を制御できます。

# suspend cronjob
oc patch cronjob logging-curator -p '{"spec":{"suspend":true}}'

# resume cronjob
oc patch cronjob logging-curator -p '{"spec":{"suspend":false}}

# change cronjob schedule
oc patch cronjob logging-curator -p '{"spec":{"schedule":"0 0 * * *"}}' 1
1
schedule オプションは、cron 形式 のスケジュールを受け入れます。