如何仅启用Google Cloud Postgresql log_statements仅对一个数据库角色?

发布于 2025-01-30 12:26:47 字数 283 浏览 3 评论 0 原文

我想仅查询登录一个特定角色。但是,似乎不可能用 cloudsqlsuperuser 角色的角色打开

postgres=> ALTER ROLE my_log_role SET log_statement = 'all';
ERROR:  permission denied to set parameter "log_statement"

它对于整个实例,可以通过云SQL工具可用,但是可以在托管的PostgreSQL中为选择角色而不是全部来完成此操作吗?

I'd like to have query logging on for one specific role only. But it doesn't seem to be possible to turn it on with the powers of cloudsqlsuperuser role that the default postgres user has:

postgres=> ALTER ROLE my_log_role SET log_statement = 'all';
ERROR:  permission denied to set parameter "log_statement"

Turning log_statement on for the entire instance is doable through Cloud SQL tools, but can this be done for select role(s) instead of all of them in a managed PostgreSQL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

莫言歌 2025-02-06 12:26:47

由于PostgreSQL的Cloud SQL是一项托管服务,因此“未提供访问,运行以下命令是必需的:

postgres=> ALTER ROLE my_log_role SET log_statement = 'all';

但是,

尽管您无法使用Superuser特权创建数据库用户,但可以使用 Cloudsqlsuperuser 角色创建数据库用户,该角色具有其中一些特权

,您可以考虑在Google Compertute上托管PostgreSQL (gce)实例,您将拥有完全控制。

As Cloud SQL for PostgreSQL is a managed service, the "superuser" access is not provided, which is required to run the below command:

postgres=> ALTER ROLE my_log_role SET log_statement = 'all';

However,

Although you can't create database users with superuser privileges, you can create database users with the cloudsqlsuperuser role which has some of those privileges

If this is a blocker, you may consider hosting PostgreSQL on a Google Compute Engine (GCE) instance, where you will have full control.

琉璃梦幻 2025-02-06 12:26:47

我能够通过首先运行以下命令来使其适用于我的AWS Aurora PostgreSQL实例:

grant set on parameter log_statement to <master_user>;

然后我能够运行Alter cole命令

i was able to get this to work for my aws aurora postgresql instance by running the following command first:

grant set on parameter log_statement to <master_user>;

then i was able to run the alter role command

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文