![](/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.