Kueri untuk tabel FunctionAppLogs

Menampilkan log aplikasi dari Aplikasi Fungsi

Daftar log aplikasi, diurutkan menurut waktu (log terbaru ditampilkan terlebih dahulu).

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

Perlihatkan log dengan peringatan atau pengecualian

Daftar log yang berisi peringatan atau pengecualian (log terbaru ditampilkan terlebih dahulu).

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

Jumlah kesalahan dan pengecualian

Tampilkan bagan kolom jumlah log yang berisi peringatan atau kesalahan dalam satu jam terakhir, per aplikasi.

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

Aktivitas fungsi dari waktu ke waktu

Bagan garis memperlihatkan tren volume permintaan Fungsi, per Fungsi dari waktu ke waktu.

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

Hasil fungsi

Pemanggilan Fungsi Individual menghasilkan satu jam terakhir (log terbaru ditampilkan terlebih dahulu).

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

Tingkat Kesalahan Fungsi

Meringkas keberhasilan dan kesalahan fungsi per jam.

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