英文:
Get details of All Class A operations in GCP Cloud Storage to Understand Cost
问题
我正在使用云存储的数据传输服务在存储桶之间进行大规模的数据传输。
我想要准确地了解我正在调用 ClassA
操作和 ClassB
操作的次数,以便了解和分析成本趋势。
想知道是否有通过编程或控制台轻松实现这一目标的方法?
英文:
I am running a large data transfer between buckets using data transfer service for cloud storage.
I want to find out exactly how many times I am invoking ClassA
operations and ClassB
operations to understand and analyse cost trends.
Would like to know if there is an easy way to achieve it programmatically or via console ?
答案1
得分: 1
启用审计日志
点击链接并为项目中的存储桶启用审计日志
Admin Read
Data Read
Data Write
https://cloud.google.com/logging/docs/audit/configure-data-access#config-console
云日志
大多数A类操作
在云日志日志浏览器中使用此正则表达式查找所有调用的A类操作,并选择时间范围
resource.type="gcs_bucket"
protoPayload.methodName=~"(storage.(buckets|objects|notifications|projects|.*AccessControls).(list|lockRetentionPolicy|compose|copy|rewrite|watchAll|delete|hmacKeys|insert|patch|update|setIamPolicy))"
大多数B类操作
在云日志日志浏览器中使用此正则表达式查找所有调用的B类操作,并选择时间范围
resource.type="gcs_bucket"
protoPayload.methodName=~"(storage.(.*).(get|getIamPolicy|testIamPermissions|AccessControls\.list|))"
要进一步筛选数据,您可以包括主体
resource.type="gcs_bucket"
protoPayload.authenticationInfo.principalEmail=“test@test-dev.iam.gserviceaccount.com "
注意:由于云日志,这将增加成本。
英文:
Enable Audit Logs
Follow the link and Enable Audit Logging for buckets in your projects with
Admin Read
Data Read
Data Write
https://cloud.google.com/logging/docs/audit/configure-data-access#config-console
Cloud Logging
Most Class A Operations
Use this regex in cloud logging logs explorer to find out all classA operations invoked and select time frame as well
resource.type="gcs_bucket"
protoPayload.methodName=~"(storage.(buckets|objects|notifications|projects|.*AccessControls).(list|lockRetentionPolicy|compose|copy|rewrite|watchAll|delete|hmacKeys|insert|patch|update|setIamPolicy))"
Most Class B Operations
Use this regex in cloud logging logs explorer to find out all classB operations invoked and select time frame as well
resource.type="gcs_bucket"
protoPayload.methodName=~"(storage.(.*).(get|getIamPolicy|testIamPermissions|AccessControls\.list|))"
To filter further your data, you can include principal
resource.type="gcs_bucket"
protoPayload.authenticationInfo.principalEmail=“test@test-dev.iam.gserviceaccount.com "
Note : It will increase the cost due to cloud logging.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论