选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

开启将日志发布到 Amazon CloudWatch 的选项 - Amazon Aurora

开启将日志发布到 Amazon CloudWatch 的选项

要将 Aurora PostgreSQL 数据库集群的 PostgreSQL 日志发布到 CloudWatch Logs,请选择集群的 Log export(日志导出)选项。在创建 Aurora PostgreSQL 数据库集群时,您可以选择 Log export(日志导出)设置。或者,您可以稍后修改集群。当您修改现有集群时,其每个实例的 PostgreSQL 日志将从那时起发布到 CloudWatch 集群。对于 Aurora PostgreSQL,PostgreSQL 日志(postgresql.log)是唯一发布到 Amazon CloudWatch 的日志。

您可以使用 AWS Management Console、AWS CLI 或 RDS API 为您的 Aurora PostgreSQL 数据库集群开启 Log export(日志导出)功能。

您可以选择 Log export(日志导出)选项,以开始将 PostgreSQL 日志从 Aurora PostgreSQL 数据库集群发布到 CloudWatch Logs。

从控制台开启 Log export(日志导出)功能
  1. 通过以下网址打开 Amazon RDS 控制台:https://console.aws.amazon.com/rds/

  2. 在导航窗格中,选择 Databases(数据库)。

  3. 选择要将其日志数据发布到 CloudWatch Logs 的 Aurora PostgreSQL 数据库集群。

  4. 选择修改

  5. Log exports(日志导出)部分中,选择 PostgreSQL log(PostgreSQL 日志)。

  6. 选择 Continue (继续),然后选择摘要页面上的 Modify cluster (修改集群)

控制台

您可以选择 Log export(日志导出)选项,以开始将 PostgreSQL 日志从 Aurora PostgreSQL 数据库集群发布到 CloudWatch Logs。

从控制台开启 Log export(日志导出)功能
  1. 通过以下网址打开 Amazon RDS 控制台:https://console.aws.amazon.com/rds/

  2. 在导航窗格中,选择 Databases(数据库)。

  3. 选择要将其日志数据发布到 CloudWatch Logs 的 Aurora PostgreSQL 数据库集群。

  4. 选择修改

  5. Log exports(日志导出)部分中,选择 PostgreSQL log(PostgreSQL 日志)。

  6. 选择 Continue (继续),然后选择摘要页面上的 Modify cluster (修改集群)

您可以开启日志导出选项,以开始使用 AWS CLI 将 Aurora PostgreSQL 日志发布到 Amazon CloudWatch Logs。为此,请使用以下选项运行 AWS CLI 命令 modify-db-cluster

  • --db-cluster-identifier—数据库集群标识符。

  • --cloudwatch-logs-export-configuration — 为数据库集群导出到 CloudWatch Logs 而设置的日志类型的配置设置。

您还可以运行以下 AWS CLI 命令之一来发布 Aurora PostgreSQL 日志:

通过以下选项运行上述 AWS CLI 命令之一:

  • --db-cluster-identifier—数据库集群标识符。

  • --engine — 数据库引擎。

  • --enable-cloudwatch-logs-exports — 为数据库集群导出到 CloudWatch Logs 而启用的日志类型的配置设置。

根据您运行的 AWS CLI 命令,可能需要其他选项。

以下命令创建一个 Aurora PostgreSQL 数据库集群以将日志文件发布到 CloudWatch Logs。

对于 Linux、macOS 或 Unix:

aws rds create-db-cluster \ --db-cluster-identifier my-db-cluster \ --engine aurora-postgresql \ --enable-cloudwatch-logs-exports postgresql

对于 Windows:

aws rds create-db-cluster ^ --db-cluster-identifier my-db-cluster ^ --engine aurora-postgresql ^ --enable-cloudwatch-logs-exports postgresql

以下命令修改现有的 Aurora PostgreSQL 数据库集群以将日志文件发布到 CloudWatch Logs。--cloudwatch-logs-export-configuration 值是 JSON 对象。此对象的键是 EnableLogTypes,其值为 postgresql

对于 Linux、macOS 或 Unix:

aws rds modify-db-cluster \ --db-cluster-identifier my-db-cluster \ --cloudwatch-logs-export-configuration '{"EnableLogTypes":["postgresql"]}'

对于 Windows:

aws rds modify-db-cluster ^ --db-cluster-identifier my-db-cluster ^ --cloudwatch-logs-export-configuration '{\"EnableLogTypes\":[\"postgresql\"]}'
注意

使用 Windows 命令提示符时,确保在 JSON 代码中转义双引号 ("),方法是使用反斜杠 (\) 作为其前缀。

以下示例修改现有的 Aurora PostgreSQL 数据库集群以禁用将日志文件发布到 CloudWatch Logs。--cloudwatch-logs-export-configuration 值是 JSON 对象。此对象的键是 DisableLogTypes,其值为 postgresql

对于 Linux、macOS 或 Unix:

aws rds modify-db-cluster \ --db-cluster-identifier mydbinstance \ --cloudwatch-logs-export-configuration '{"DisableLogTypes":["postgresql"]}'

对于 Windows:

aws rds modify-db-cluster ^ --db-cluster-identifier mydbinstance ^ --cloudwatch-logs-export-configuration "{\"DisableLogTypes\":[\"postgresql\"]}"
注意

使用 Windows 命令提示符时,必须在 JSON 代码中转义双引号 ("),方法是使用反斜杠 (\) 作为其前缀。

您可以开启日志导出选项,以开始使用 AWS CLI 将 Aurora PostgreSQL 日志发布到 Amazon CloudWatch Logs。为此,请使用以下选项运行 AWS CLI 命令 modify-db-cluster

  • --db-cluster-identifier—数据库集群标识符。

  • --cloudwatch-logs-export-configuration — 为数据库集群导出到 CloudWatch Logs 而设置的日志类型的配置设置。

您还可以运行以下 AWS CLI 命令之一来发布 Aurora PostgreSQL 日志:

通过以下选项运行上述 AWS CLI 命令之一:

  • --db-cluster-identifier—数据库集群标识符。

  • --engine — 数据库引擎。

  • --enable-cloudwatch-logs-exports — 为数据库集群导出到 CloudWatch Logs 而启用的日志类型的配置设置。

根据您运行的 AWS CLI 命令,可能需要其他选项。

以下命令创建一个 Aurora PostgreSQL 数据库集群以将日志文件发布到 CloudWatch Logs。

对于 Linux、macOS 或 Unix:

aws rds create-db-cluster \ --db-cluster-identifier my-db-cluster \ --engine aurora-postgresql \ --enable-cloudwatch-logs-exports postgresql

对于 Windows:

aws rds create-db-cluster ^ --db-cluster-identifier my-db-cluster ^ --engine aurora-postgresql ^ --enable-cloudwatch-logs-exports postgresql

以下命令修改现有的 Aurora PostgreSQL 数据库集群以将日志文件发布到 CloudWatch Logs。--cloudwatch-logs-export-configuration 值是 JSON 对象。此对象的键是 EnableLogTypes,其值为 postgresql

对于 Linux、macOS 或 Unix:

aws rds modify-db-cluster \ --db-cluster-identifier my-db-cluster \ --cloudwatch-logs-export-configuration '{"EnableLogTypes":["postgresql"]}'

对于 Windows:

aws rds modify-db-cluster ^ --db-cluster-identifier my-db-cluster ^ --cloudwatch-logs-export-configuration '{\"EnableLogTypes\":[\"postgresql\"]}'
注意

使用 Windows 命令提示符时,确保在 JSON 代码中转义双引号 ("),方法是使用反斜杠 (\) 作为其前缀。

以下示例修改现有的 Aurora PostgreSQL 数据库集群以禁用将日志文件发布到 CloudWatch Logs。--cloudwatch-logs-export-configuration 值是 JSON 对象。此对象的键是 DisableLogTypes,其值为 postgresql

对于 Linux、macOS 或 Unix:

aws rds modify-db-cluster \ --db-cluster-identifier mydbinstance \ --cloudwatch-logs-export-configuration '{"DisableLogTypes":["postgresql"]}'

对于 Windows:

aws rds modify-db-cluster ^ --db-cluster-identifier mydbinstance ^ --cloudwatch-logs-export-configuration "{\"DisableLogTypes\":[\"postgresql\"]}"
注意

使用 Windows 命令提示符时,必须在 JSON 代码中转义双引号 ("),方法是使用反斜杠 (\) 作为其前缀。

您可以开启日志导出选项,以开始使用 RDS API 发布 Aurora PostgreSQL 日志。为此,您可以使用以下选项运行 ModifyDBCluster 操作:

  • DBClusterIdentifier – 数据库集群标识符。

  • CloudwatchLogsExportConfiguration – 为数据库集群导出到 CloudWatch Logs 而启用的日志类型的配置设置。

您还可以通过运行以下 RDS API 操作之一,使用 RDS API 发布 Aurora PostgreSQL 日志:

使用以下参数运行 RDS API 操作:

  • DBClusterIdentifier—数据库集群标识符。

  • Engine — 数据库引擎。

  • EnableCloudwatchLogsExports — 为数据库集群导出到 CloudWatch Logs 而启用的日志类型的配置设置。

根据您运行的 AWS CLI 命令,可能需要其他参数。

您可以开启日志导出选项,以开始使用 RDS API 发布 Aurora PostgreSQL 日志。为此,您可以使用以下选项运行 ModifyDBCluster 操作:

  • DBClusterIdentifier – 数据库集群标识符。

  • CloudwatchLogsExportConfiguration – 为数据库集群导出到 CloudWatch Logs 而启用的日志类型的配置设置。

您还可以通过运行以下 RDS API 操作之一,使用 RDS API 发布 Aurora PostgreSQL 日志:

使用以下参数运行 RDS API 操作:

  • DBClusterIdentifier—数据库集群标识符。

  • Engine — 数据库引擎。

  • EnableCloudwatchLogsExports — 为数据库集群导出到 CloudWatch Logs 而启用的日志类型的配置设置。

根据您运行的 AWS CLI 命令,可能需要其他参数。

隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。