ページの先頭行へ戻る
Enterprise Postgres 15 オペレーターリファレンス

1.2.16 FEP カスタムリソース - spec.fep.pgAuditLog

1.2.16.1 pgAuditLog.endpoint.authenticationの詳細

プロトコル

必要なキー

説明

'http' or not defined

basic_auth

http Web サーバーの基本認証

's3'

aws_access_key

AWS アクセスキー

aws_secret_key

AWS シークレットキー

'blob'

azure_storage_account_name

Azure ストレージアカウント名

azure_storage_account_key

Azure ストレージアカウントキー

オペレーター は、「pgAuditLog.endpoint.authentication」が定義されていないか空の場合、値が空のすべてのプロトコルのキーを使用してデフォルトのシークレットを作成します。

デフォルトのシークレットは、エンド ユーザーが適切な値を更新できるテンプレートです。 以下はその内容です。

デフォルトの認証シークレット

kind: Secret
apiVersion: v1
metadata:
  name: [FEPCluster name]-pgauditlog-auth
  namespace: [FEPCluster namespace]
type: Opaque
data:

    basic_auth: "" 
    aws_access_key: ""
    aws_access_secret: ""

    azure_storage_account_name: ""
    azure_storage_account_key: ""

デフォルトのシークレットが作成されると、Operator は FEPCluster CR で作成されたシークレット名も更新します。

FEPCluster

spec.fep
pgAuditLog:
 enable: 'true'
 endpoint:
   protocol: 's3'
   authentication: '[FEPCluster name]-pgauditlog-auth'
……

オペレーターはデフォルトのシークレットを使用しますが、シークレットに正しい値が含まれていないため、アップロード機能は失敗します。 そのため、アップロード機能を適切に使用するには、エンド ユーザーがデフォルト シークレットの値を更新する必要があります。

注意

  • オペレーターはエンド ユーザーによって作成されるため、ユーザー指定のシークレットを所有しません。 オペレーターによって作成されたデフォルトのシークレットのみがクラスターによって所有されます。

  • FEPCluster が削除された場合、このシークレットは残ります。

1.2.16.2 カスタマイズされた pgaudit ConfigMap の CR の例

FEPCluster

spec.fep
pgAuditLog:
 enable: 'true'
 config: my-pgaudit-conf
 endpoint: … …
# fepChildCrVal.customPgAudit will be ignored in this case

ConfigMap - Name: my-pgaudit-conf

data:
 pgaudit.conf: |
  [output]
  logger = 'auditlog'
  log_directory = '/database/log/audit'
  [rule]
  audit_role='jason'
  database='demo'
  class='READ, WRITE'
  [option]

1.2.16.3 ログを Azure Blob にアップロードするときの CR の例

Azure BLOB をエンドポイントとして使用して pgAudit ファイルをアップロードします。

FEPCluster (エンドポイントとして Azure BLOB を使用)

spec.fep
pgAuditLog:
 enable: 'true'
 endpoint:
  protocol: 'blob'
  authentication: my-azure-blob-secret
  azureContainerName: cluster1
  azureBlobName: pgaudit-log-1
 schedules:
  upload: '30 * * * *'

Secret - Name: my-azure-blob-secret

data:
   azure_storage_account_name: cG9zdGdyZXM=
   azure_storage_account_key: ZnNcG9zdGads3cGzdGdyZXMyZXMlcA==

1.2.16.4 ログを S3 にアップロードするための CR の例

AWS S3 をエンドポイントとして使用して pgAudit ファイルをアップロードします。

● pgAudit ログは、指定されたスケジュールに基づいて AWS s3 ストレージにアップロードされます。

FEPCluster (S3 をエンドポイントとして使用)

spec.fep
pgAuditLog:
 enable: 'true'
 endpoint:
  url: 's3://pgaudit1/cluster1'
  protocol: 's3'
  authentication: my-aws-s3-secret
 schedules:
  upload: '30 * * * *'

Secret - Name: my-aws-s3-secret

data:
   aws_access_key: cG9zdGdyZXM=
   aws_access_secret: ZnNlcaAZnNlcA3A==