添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

範例 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

容器群組的名稱。

Type: String Position:Named Default value:None Required:True Accept pipeline input:False Accept wildcard characters:False

-ContainerName

容器實例的名稱。

Type: String Position:Named Default value:None Required:True Accept pipeline input:False Accept wildcard characters:False

-DefaultProfile

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

Type: PSObject Aliases:AzureRMContext, AzureCredential Position:Named Default value:None Required:False Accept pipeline input:False Accept wildcard characters:False

-ResourceGroupName

資源群組的名稱。

Type: String Position:Named Default value:None Required:True Accept pipeline input:False Accept wildcard characters:False

-SubscriptionId

可唯一識別 Microsoft Azure 訂用帳戶的訂用帳戶認證。 訂用帳戶識別碼會構成每個服務呼叫 URI 的一部分。

Type: String [ ] Position:Named Default value:(Get-AzContext).Subscription.Id Required:False Accept pipeline input:False Accept wildcard characters:False

-Tail

要從容器實例記錄尾端顯示的行數。 如果未提供,則所有可用的記錄最多會顯示 4mb。

Type: Int32 Position:Named Default value:None Required:False Accept pipeline input:False Accept wildcard characters:False

-Timestamp

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

Type: SwitchParameter Position:Named Default value:None Required:False Accept pipeline input:False Accept wildcard characters:False