简体   繁体   English

从本地文件系统读取 Azure 审计日志

[英]Read Azure Audit Logs from Local File System

I have downloaded the Azure Audit Logs in my Local Drive.我已在本地驱动器中下载了 Azure 审核日志。

I am trying to read them from my local machine.我正在尝试从我的本地机器上读取它们。

I am using below query我正在使用以下查询

select * FROM sys.fn_get_audit_file('C:\Ran\Audit\Chevron\2020-04-10\01_48_07_838_426.xel',DEFAULT,DEFAULT)

Got below error An error occurred in reading from the audit file or file-pattern: 'C:\Ran\Audit\Chevron\2020-04-10\01_48_07_838_426.xel'.出现以下错误从审核文件或文件模式读取时发生错误:'C:\Ran\Audit\Chevron\2020-04-10\01_48_07_838_426.xel'。 The SQL service account may not have Read permission on the files, or the pattern may be returning one or more corrupt files. SQL 服务帐户可能没有文件的读取权限,或者该模式可能返回一个或多个损坏的文件。

I have given full rights to folder: Chevron[On where the Audit file are placed]我已授予文件夹的全部权限:Chevron[在放置审核文件的位置]

I download my Azure SQL database audit file from blob storage and copy it to the Local SQL Server Audit folder.我从 blob 存储下载了我的 Azure SQL 数据库审计文件,并将其复制到本地 SQL 服务器审计文件夹。

Then login my on-premise SQL Server with admin account "sa", run the query and evertthing works well.然后使用管理员帐户“sa”登录我的本地 SQL 服务器,运行查询,一切正常。

For example:例如:

Read the audit file 01_13_36_510_0.xel in blog storage in Azure SQL database:读取 Azure SQL 数据库中博客存储中的审计文件01_13_36_510_0.xel 在此处输入图像描述

Then copy it to local SQL Server audit folder and run the query again:然后将其复制到本地 SQL 服务器审核文件夹并再次运行查询:

在此处输入图像描述

If you want read the audit file, you must have the permission :如果你想阅读审计文件,你必须有权限

  • SQL Server: Requires the CONTROL SERVER permission. SQL 服务器:需要CONTROL SERVER权限。
  • Azure SQL DB : Requires the CONTROL DATABASE permission. Azure SQL DB :需要控制数据库权限。

    1. Server admins can access audit logs of all databases on the server.服务器管理员可以访问服务器上所有数据库的审计日志。

    2. Non server admins can only access audit logs from the current database.非服务器管理员只能从当前数据库访问审计日志。

    3. Blobs that do not meet the above criteria will be skipped (a list of skipped blobs will be displayed in the query output message), and the function will return logs only from blobs for which access is allowed.不满足上述条件的 Blob 将被跳过(跳过的 Blob 列表将显示在查询 output 消息中),并且 function 将仅从允许访问的 Blob 返回日志。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM