Get-AzContainerInstanceLog
语法
Default (默认值)
Get-AzContainerInstanceLog
-ContainerGroupName <String>
-ContainerName <String>
-ResourceGroupName <String>
[-SubscriptionId <String[]>]
[-Tail <Int32>]
[-Timestamp]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
说明
示例
示例 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 中的测试容器获取尾 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
目标订阅的 ID。
该值必须是 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。
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters 。
输出