Azure PowerShell Documentation

Get-AzContainerInstanceLog

Synopsis: Retrieves the logs of a container instance in Azure Container Instances.

Syntax

Get-AzContainerInstanceLog
   -ResourceGroupName <String>
   -Name <String>
   [-ContainerName <String>]
   [-Tail <Int32>]
   [-Since <DateTime>]
   [-Follow]
   [<CommonParameters>]

Parameters

ParameterTypeDescription
-ResourceGroupNameStringName of the resource group containing the container instance.
-NameStringName of the container instance.
-ContainerNameStringSpecific container within the instance. Optional; if omitted, logs from all containers are returned.
-TailInt32Number of lines from the end of the logs to retrieve. Default is all lines.
-SinceDateTimeReturn logs since this timestamp. Accepts ISO 8601 format.
-FollowSwitchParameterContinuously stream new log entries until the command is stopped.
-WhatIfSwitchParameterShows what would happen if the command runs.
-ConfirmSwitchParameterPrompts for confirmation before executing.

Examples

Example 1: Retrieve the last 100 lines of logs for a container instance.

Get-AzContainerInstanceLog -ResourceGroupName "MyRG" -Name "myContainerInstance" -Tail 100

Example 2: Stream logs in real‑time for a specific container.

Get-AzContainerInstanceLog -ResourceGroupName "MyRG" -Name "myContainerInstance" -ContainerName "web" -Follow

Related Commands