admin管理员组文章数量:1389762
I have a FastAPI application deployed on Cloud Run, and I'm trying to capture the user or service account that made a request in the Cloud Run logs. Currently, the logs only show standard Python request logs without any details about the authenticated user.
The application is secured using Cloud Run authentication, so requests are made by either authenticated users or service accounts. I would like to see this information in the logs without manually adding logging logic inside the FastAPI app (at least for now).
Checked Cloud Logging (Logs Explorer)
Looked at resource.type="cloud_run_revision" logs, but no user identity is shown. Also checked jsonPayload, but it doesn't contain details about who made the request. Increased logging verbosity in Cloud Run
Looked at run.googleapis/request_count metric, but it doesn’t include authentication details.
I was hoping that Cloud Run logs would automatically capture the authenticated user or service account making the request.
Ideally, I would like to avoid adding manual logging in the FastAPI application (I know that I could log the Authorization header, decode the JWT token, and extract user info, but I’d prefer to see if Cloud Run itself can provide this information).
Is there a way to configure Cloud Run, Cloud Logging, or Cloud Monitoring to capture and display this information?
版权声明:本文标题:authentication - How to log the authenticated user or service account in Cloud Run request logs? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744649666a2617609.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论