有人可以指导我检索存储队列服务的日志信息,类似于我在本文中用红色圈出的部分吗?
图片:
我使用 Python Azure SDK 来执行此操作
谢谢你!
我想检查读写删除操作是否已启用,但目前我还没有找到 Microsoft 的任何类似文档。
有人可以指导我检索存储队列服务的日志信息,类似于我在本文中用红色圈出的部分吗?
您可以使用以下代码通过 Azure Python SDK 检索存储队列服务的日志记录信息。
您需要在您的环境中安装 azure-storage-queue 软件包。
代码:
from azure.storage.queue import QueueServiceClient
connection_string = "xxxx"
queue_service_client = QueueServiceClient.from_connection_string(connection_string)
service_properties = queue_service_client.get_service_properties()
analytics_logging = service_properties.get("analytics_logging")
print(analytics_logging)
上面的代码使用
Azure Storage Queue Python SDK
使用连接字符串连接到 Azure 存储帐户。然后,它使用连接字符串创建一个 QueueServiceClient
对象并检索队列服务的服务属性。最后,它从服务属性中检索分析日志记录设置。
输出:
{'version': '1.0', 'delete': False, 'read': False, 'write': False, 'retention_policy': <azure.storage.queue._models.RetentionPolicy object at 0x000002288F89A9D0>}
同样,您可以使用 azure-storage-blob 和 azure-storage-table 包来检索 Azure 存储 Blob、使用 Azure Python SDK 的表服务的日志记录信息。