Azure SQL 存储数据库日志

huangapple go评论60阅读模式
英文:

Azure SQL storing database logs

问题

在Azure SQL数据库中存储日志时,是否需要显式创建用于存储日志的Blob,还是它会隐式创建?我阅读了这篇文章这篇文章,但仍然不确定。

另外,对于部署在应用服务中的Java/Spring应用程序,在使用应用洞察、日志分析和Azure应用程序日志、HTTP和访问日志以及数据库日志时,是否需要显式设置Blob来存储日志?

英文:

For storing Azure SQL database logs, is it necessary to explicitly create blob for logs storage or it is implicitly created. I read this and this post but still not sure about it?

Also, for Java/Spring application deployed in App Services, when using App Insights, Log Analytics and Azure Monitor for Application logs, HTTP and Access logs and DB logs, do I need to explicitly setup blob for storing logs?

答案1

得分: 1

不需要为Azure SQL数据库日志创建Blob存储,因为它们存储在Azure SQL数据库事务日志中,可以使用Azure Monitor查看或使用Azure SQL审计进行审计。

在"Monitor"部分检查SQL数据库日志的步骤。

  1. 创建Azure SQL数据库和服务器后。
  2. 转到监视选项卡,如下面的截图所示,即可查看日志。

方法2

使用Log Analytics

  1. 在Azure中创建一个Log Analytics工作区。
  2. 转到SQL数据库,选择监视选项卡中的左侧窗格中的"诊断"。

Azure SQL 存储数据库日志

  1. 添加一个诊断设置,选择创建的Log Analytics,并选择下面截图中所述的日志选项。

Azure SQL 存储数据库日志

  1. 您可以在下面显示的日志中找到日志。

Azure SQL 存储数据库日志

要显式存储Azure SQL日志

  1. 您需要为存储日志创建一个"存储帐户"。

  2. 并从您的SQL服务器启用Azure Monitor日志,然后从Azure Monitor菜单中选择"诊断日志",然后打开日志并选择您创建的存储帐户。

  3. 通过选择Azure Monitor菜单中的"日志"选项卡,然后选择"保留策略"来配置日志保留的持续时间。

  4. 要验证存储帐户中的日志,请转到存储帐户,然后选择"容器"。您应该看到一个名为"insights-logs-sqlserverauditlog"的容器。然后,您可以浏览存储在此容器中的日志。

英文:

No, you do not need to create a blob storage for Azure SQL database logs as they are stored in Azure SQL database transaction logs and can be viewed using Azure Monitor or audited using Azure SQL Auditing.

Steps to check the Logs in SQL DB under Monitor section.

  1. After creating azure SQL database and server.
  2. Go to monitoring tab as mentioned in below screenshot and the logs can be viewed.

Azure SQL 存储数据库日志

Approach 2

Using Log Analytics

  1. Create a Log analytics workspace in Azure.
  2. And go to the SQL Database and choose the Diagnostics from left pane in monitoring tab.

Azure SQL 存储数据库日志

  1. Add a diagnostic setting and choose the created log analytics and choose the log option as mentioned in below screenshot.

Azure SQL 存储数据库日志

  1. You can find the logs as shown below.

Azure SQL 存储数据库日志

To store the Azure SQL Logs explicitly

  1. You need to create 'Storage Account' for storing logs.

  2. And have to enable Azure Monitor Logs from your SQL server and select 'Diagnostic logs' from the Azure Monitor menu and then, turn on the logs and select the storage account you created.

  3. And configure log retention by selecting the Logs tab in the Azure Monitor menu, and then choose 'Retention policy' to configure how long logs will be retained.

  4. To verify logs in the storage account, go to the storage account and select 'Containers.' You should see a container named 'insights-logs-sqlserverauditlog.' You can then browse the logs stored in this container.

huangapple
  • 本文由 发表于 2023年2月8日 15:10:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/75382410.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定