Delen via


Query's voor de ContainerLog-tabel

Zie de zelfstudie over Log Analytics voor meer informatie over het gebruik van deze query's in Azure Portal. Zie Query voor de REST API.

Een waarde zoeken in de tabel Containerlogboeken

** Voor deze query moet een parameter worden uitgevoerd. De tabel ContainerLogboeken wordt gebruikt voor logboeklijnen die zijn verzameld uit stdout- en stderr-streams voor containers. Deze query vindt rijen in de containerlogs-tabel waarin LogEntry tekenreeks heeft opgegeven.

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

Factureerbare logboekgegevens per logboektype

Zie containerlogboeken factureerbare gegevens voor de laatste 7d, gescheiden door logboektype.

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

Containerlogboeken per naamruimte weergeven

Containerlogboeken van alle naamruimten in het cluster weergeven.

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

Zoeken in ContainerLog

Zoek in ContainerLog om te zoeken naar een specifieke waarde in de ContainerLog-tabel./nNote dat voor deze query de <SeachValue-parameter> moet worden bijgewerkt om resultaten te produceren

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