[英]Log Analytics KQL with Time Range does not work from App Insights using “workspace”
[英]App Insights REST call using KQL query returns empty
按照 Microsoft 文檔,我想查詢App Insights資源以獲取跟蹤事件。 如果我使用特定端點直接訪問跟蹤:
https://api.applicationinsights.io/v1/apps/$aiAppId/events/traces
它完美地工作。 但我無法使用KQL查詢:
$aiAppId = 'my_app_insights_app_id'
$aiApiKey = 'my_app_insights_api_key'
$content = (Invoke-WebRequest -Uri "https://api.applicationinsights.io/v1/apps/$aiAppId/query" `
-Method Post -UseBasicParsing `
-Headers @{
'x-api-key' = $aiApiKey
} `
-Body @{
'timespan' = 'PT60M'
'query' = 'traces | where timestamp >= ago(30m)'
}
).Content
$content | ConvertFrom-Json
它產生一個空結果:
tables
------
{}
從Azure 門戶執行 KQL 查詢我得到正確的結果。
我錯過了什么嗎? 任何幫助都非常感謝。
此致。
賈科莫 SS
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.