如何分析储账户日志记录
出于审计的要求,我们需要对存储账户的读取、写入等行为进行分析,因此 Azure 提供了存储账户日志记录功能,本文将介绍如何分析存储账户日志记录。
前提条件
已经为目标存储账户开启诊断日志(经典)- 日志记录功能。
已经在本地安装 Microsoft Azure Storage Explorer。
解决方案
使用 Microsoft Azure Storage Explorer 下载日志,日志位于存储账户的 Blob Containers - $logs 目录中:
由于默认的日志是 .log 格式,我们需要进行格式调整,以便于分析。
首先使用记事本打开日志,在开头加入以下表头信息并保存:
<version-number>;<request-start-time>;<operation-type>;<request-status>;<http-status-code>;<end-to-end-latency-in-ms>;<server-latency-in-ms>;<authentication-type>;<requester-account-name>;<owner-account-name>;<service-type>;<request-url>;<requested-object-key>;<request-id-header>;<operation-count>;<requester-ip-address>;<request-version-header>;<request-header-size>;<request-packet-size>;<response-header-size>;<response-packet-size>;<request-content-length>;<request-md5>;<server-md5>;<etag-identifier>;<last-modified-time>;<conditions-used>;<user-agent-header>;<referrer-header>;<client-request-id>
然后新建 Excel,使用 Data-From Text/CSV 导入上述日志即可查看详细信息:
我们可以使用 Excel 筛选功能,来获取特定类型的操作记录,有关表头的详细说明请参考文档存储分析日志格式。