Condividi tramite


Query per la tabella ContainerLog

Per informazioni sull'uso di queste query nella portale di Azure, vedere Esercitazione su Log Analytics. Per l'API REST, vedere Query.

Trovare un valore nella tabella Log contenitori

** Per eseguire questa query è necessario un parametro. La tabella Log contenitori viene usata le righe di log raccolte dai flussi stdout e stderr per i contenitori. Questa query troverà righe nella tabella ContainerLogs in cui LogEntry ha specificato String.

//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

Dati di log fatturabili per tipo di log

Vedere i dati fatturabili dei contenitori per gli ultimi 7d, separati in base al tipo di log.

// 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

Elencare i log dei contenitori per spazio dei nomi

Visualizzare i log dei contenitori da tutti gli spazi dei nomi nel cluster.

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

Trova in ContainerLog

Trovare in ContainerLog per cercare un valore specifico nella tabella ContainerLog./nNote che questa query richiede l'aggiornamento del <parametro SeachValue> per produrre risultati

// 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