Stackdriver Google Python API访问被拒绝

2024-09-28 19:28:25 发布

您现在位置:Python中文网/ 问答频道 /正文

当尝试使用Google Cloud python3api客户端创建一个sink时,我得到了一个错误:

RetryError: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with (StatusCode.PERMISSION_DENIED, The caller does not have permission)>)

我使用的代码是这样的:

^{pr2}$

我不太明白为什么会这样。当我使用lclient.log_struct()时,我可以看到到达日志控制台的日志,因此我可以访问Stackdriver日志记录。在

这个设置有什么错误吗?在

提前谢谢。在


Tags: incloud客户端that错误googleexceptionnot
1条回答
网友
1楼 · 发布于 2024-09-28 19:28:25

创建接收器需要与写入日志项不同的权限。默认情况下,服务帐户被赋予项目编辑器(而不是所有者),后者无权创建接收器。在

请参阅所需权限列表in the access control docs。在

确保您使用的服务帐户具有logging.sinks.create权限。最简单的方法是将服务帐户从Editor切换到Owner,但是最好添加Logs Editor角色,这样您只需授予它所需的权限。在

相关问题 更多 >