FunctionAppLogs テーブルのクエリ

Azure portal でこれらのクエリを使用する方法については、 Log Analytics のチュートリアルを参照してください。 REST API については、「 Query」を参照してください。

関数アプリからアプリケーション ログを表示する

時間で並べ替えられたアプリケーション ログの一覧 (最初に表示された最新のログ)。

FunctionAppLogs 
| project TimeGenerated, HostInstanceId, Message, _ResourceId
| sort by TimeGenerated desc

警告または例外を含むログを表示する

警告または例外を含むログの一覧 (最初に表示された最新のログ)。

FunctionAppLogs
| where Level == "Warning" or Level == "Error"
| project TimeGenerated, HostInstanceId, Level, Message, _ResourceId
| sort by TimeGenerated desc

エラーと例外の数

アプリケーションごとの過去 1 時間の警告またはエラーを含むログの数の縦棒グラフを表示します。

FunctionAppLogs 
| where TimeGenerated > ago(1h)
| where Level == "Warning" or Level == "Error"
| summarize count_per_app = count() by _ResourceId
| sort by count_per_app desc 
| render columnchart

時系列の関数アクティビティ

関数要求量の傾向を示す折れ線グラフ (時間の経過に伴う関数別)。

FunctionAppLogs
//| where _ResourceId == "MyResourceId" // Uncomment and enter a resource ID to get results for a specific resource
| where Category startswith "Function." and Message startswith "Executed "
| summarize count() by bin(TimeGenerated, 1h), FunctionName // Aggregate by hour
| render timechart

関数の結果

個々の関数呼び出しの結果は、過去 1 時間になります (最初に表示された最新のログ)。

FunctionAppLogs
| where TimeGenerated > ago(1h)
| where Category startswith "Function." and Message startswith "Executed "
| parse Message with "Executed '" Name "' ("  Result ", Id=" Id ", Duration=" Duration:long "ms)"
| project TimeGenerated, FunctionName, Result, FunctionInvocationId, Duration, _ResourceId
| sort by TimeGenerated desc

関数のエラー発生率

関数の成功と 1 時間あたりのエラーの概要。

FunctionAppLogs
| where Category startswith "Function." and Message startswith "Executed "
| parse Message with "Executed '" Name "' ("  Result ", Id=" Id ", Duration=" Duration:long "ms)"
// | where Name == "MyFunction" // Use this to restrict to a specific function
| summarize count() by bin(TimeGenerated, 1h), Name, Result, _ResourceId
| order by TimeGenerated desc