繁体   English   中英

Azure App Insight 查询以查看数据库连接和错误

[英]Azure App Insight query to see the DB connection and errors

如果有任何与 SQL DB 相关的故障,我必须进行监视和警报。 我必须在 azure app insights 中查看相同的日志。 如何查询是否有与数据库相关的故障? 谢谢您的帮助。

Sql 查询通常作为依赖项进行跟踪,因此类似的查询

dependencies
| where ['type'] == "SQL"
| where success == false

应该给你任何失败:

在此处输入图像描述

如果要检查 sql 连接问题,则必须检查exceptions表。 例如,如果密码不正确,将出现System.Data.SqlClient.SqlException异常。 如果连接字符串包含无效关键字,您将收到System.ArgumentException异常。 示例查询是

exceptions
| where ['type'] == "System.Data.SqlClient.SqlException"
| where outerMessage contains "Login failed"

exceptions
| where ['type'] == "System.ArgumentException"
| where outerMessage contains "Keyword not supported"

暂无
暂无

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

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