共用方式為


Get-AzContainerInstanceLog

取得指定資源群組和容器群組中指定容器執行個體的記錄。

語法

Default (預設值)

Get-AzContainerInstanceLog
    -ContainerGroupName <String>
    -ContainerName <String>
    -ResourceGroupName <String>
    [-SubscriptionId <String[]>]
    [-Tail <Int32>]
    [-Timestamp]
    [-DefaultProfile <PSObject>]
    [<CommonParameters>]

Description

取得指定資源群組和容器群組中指定容器執行個體的記錄。

範例

範例 1:取得容器執行個體的尾部記錄

Get-AzContainerInstanceLog -ContainerGroupName test-cg -ContainerName test-container -ResourceGroupName test-rg
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up

從容器群組 test-cg 中的 test-container 取得記錄。 根據預設,它最多會傳回 4MB 的記錄內容。

範例 2:取得容器執行個體的尾部 2 行日誌

Get-AzContainerInstanceLog -ContainerGroupName test-cg -ContainerName test-container -ResourceGroupName test-rg -Tail 2
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up

從容器組 test-cg 中的 test-container 獲取尾部 2 行日誌。

參數

-ContainerGroupName

容器群組的名稱。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-ContainerName

容器執行個體的名稱。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-DefaultProfile

DefaultProfile 參數無法運作。 如果針對不同的訂用帳戶執行 Cmdlet,請使用 SubscriptionId 參數。

參數屬性

類型:PSObject
預設值:None
支援萬用字元:False
不要顯示:False
別名:AzureRMContext, AzureCredential

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-ResourceGroupName

資源群組的名稱。 名稱不區分大小寫。

參數屬性

類型:String
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-SubscriptionId

目標訂用帳戶的標識碼。 此值必須是 UUID。

參數屬性

類型:

String[]

預設值:(Get-AzContext).Subscription.Id
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Tail

從容器執行個體日誌的尾部顯示的行數。 如果未提供,則所有可用的日誌最多顯示 4mb。

參數屬性

類型:Int32
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Timestamp

如果為true,則會在記錄輸出的每一行開頭新增時間戳記。 如果未提供,則預設為 false。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 cmdlet 支援常見參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters

輸出

String