![](/img/trans.png)
[英]Access Azure Data Explorer with Kusto.Data in Azure Function -- Kusto failed to send request -- local debugging works
[英]How to use Kusto to access Azure Function app code logging() message?
I have a Python Azure Function that has a bunch of Python logging.error()/logging.info()
messages. 我喜欢这种方法(我对 Python 还很陌生),因为我可以查看运行历史记录并查看有关运行的关键信息。
示例 1:
这个 Kusto 查询让我了解了有关给定运行的基础知识,但没有任何细节
requests
| project timestamp, id, operation_Name, success, resultCode, duration, operation_Id, cloud_RoleName, invocationId=customDimensions['InvocationId']
| where timestamp > ago(6d)
| where cloud_RoleName =~ 'functionAppName' and operation_Name =~ 'functionName'
| order by timestamp asc
Output:
示例 2:
此查询为我提供了我需要的所有详细信息,但我必须定义operation_id
和InvocationId
union traces
| union exceptions
| where timestamp > ago(30d)
| where operation_Id == '<biglongstring>'
| where customDimensions['InvocationId'] == '<biglongstring1>'
| order by timestamp asc
| project timestamp, message = iff(message != '', message, iff(innermostMessage != '', innermostMessage, customDimensions.['prop__{OriginalFormat}'])), logLevel = customDimensions.['LogLevel']
Output:
我需要查询在这些logging()
消息中找到的特定关键字。
如何使用 Kusto 查询执行此操作?
以下是最终为我工作的内容。
| where message contains "specific string in logging"
| where message contains "specific string in logging"
是关键。 这里的message
有我正在寻找的日志记录字符串。
union traces
| union exceptions
| where timestamp > ago(30d)
| where message contains "specific string in logging"
| order by timestamp asc
| project timestamp, message = iff(message != '', message, iff(innermostMessage != '', innermostMessage, customDimensions.['prop__{OriginalFormat}'])), logLevel = customDimensions.['LogLevel']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.