ContainerLog テーブルのクエリ

コンテナー ログ テーブルで値を検索する

** このクエリを実行するにはパラメーターが必要です。 コンテナー ログ テーブルは、コンテナーの stdout ストリームと stderr ストリームから収集されたログ行を使用します。 このクエリでは、LogEntry で String が指定されている ContainerLogs テーブル内の行が検索されます。

//This qeury requires a parameter to work.
//The ContainerLog table holds Log lines collected from stdout and stderr streams for containers.
//Note: the query runs by default for the last 24 hours. Use the time pikcer to adjust time span for query
let FindString = "";//Please update term  you would like to find in LogEntry here
ContainerLog 
| where LogEntry has FindString 
|take 100

ログの種類別の課金対象ログ データ

ログの種類別に分離された最後の 7d のコンテナー ログ課金対象データに関するページを参照してください。

// Set the requested time, anytime greater than 15d can take longer
let billableTimeView = 7d;  
//Join ContainerLog on KubePodInventory for LogEntry source
ContainerLog
| join(KubePodInventory | where TimeGenerated > startofday(ago(billableTimeView)))on ContainerID
| where TimeGenerated > startofday(ago(billableTimeView))
| summarize Total=sum(_BilledSize)/ 1000 by bin(TimeGenerated, 1d), LogEntrySource

名前空間ごとにコンテナー ログを一覧表示する

クラスター内のすべての名前空間のコンテナー ログを表示します。

ContainerLog
|where TimeGenerated > startofday(ago(1h))
|join(
KubePodInventory
| where TimeGenerated > startofday(ago(1h)) 
| distinct Computer, ContainerID, Namespace
)//KubePodInventory Contains namespace information
on Computer, ContainerID
| project TimeGenerated, ContainerID, Namespace , LogEntrySource , LogEntry

ContainerLog で検索する

ContainerLog で検索し、ContainerLog テーブル内の特定の値を検索します。/nNote では、結果を生成するために SeachValue> パラメーターを<更新する必要があります

// This query requires a parameter to run. Enter value in SearchValue to find in table.
let SearchValue =  "<SearchValue>";//Please update term you would like to find in the table.
ContainerLog
| where * contains tostring(SearchValue)
| take 1000