我们可以在 Google Cloud Spanner 中获取 DML 语句执行的 bin 日志吗?尝试启用“数据访问写入”日志,但它没有提供与 mysql 或其他关系数据库相同的 bin 日志。
https://cloud.google.com/spanner/docs/audit-logging
https://cloud.google.com/logging/docs/audit/configure-data-access
我们可以在 Google Cloud Spanner 中获取 DML 语句执行的 bin 日志吗?尝试启用“数据访问写入”日志,但它没有提供与 mysql 或其他关系数据库相同的 bin 日志。
https://cloud.google.com/spanner/docs/audit-logging
https://cloud.google.com/logging/docs/audit/configure-data-access
ExecuteSql 和 ExecuteStreamingSql 的数据访问审计日志包含 SQL 语句,因此您可以通过为“Cloud Spanner API”启用“数据写入”审计日志来生成 DML 语句的日志,如https://cloud.google.com/中所述记录/文档/审计/配置数据访问#config-console-enable:
SQL 语句包含在为 ExecuteSql 生成的单个日志条目或为 ExecuteStreamingSql 生成的第一个日志条目中,在字段 protoPayload.request.sql 中。例如,以下是为 ExecuteStreamingSql 请求生成的日志条目:
Cloud Spanner 不包含用于生成二进制日志(如 MySQL)的内置实用程序。您必须实现自己的更改日志表来跟踪更改。
您还可以使用审核日志来跟踪执行更改的人员。因此,使用审核日志和您自己的更改日志表将是跟踪更改的理想解决方案。