Get-AzureRmContainerInstanceLog
Get the logs of a container instance in a container group.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
Get-AzureRmContainerInstanceLog
[-ResourceGroupName] <String>
-ContainerGroupName <String>
[-Name <String>]
[-Tail <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmContainerInstanceLog
-InputContainerGroup <PSContainerGroup>
[-Name <String>]
[-Tail <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureRmContainerInstanceLog
-ResourceId <String>
[-Name <String>]
[-Tail <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzureRmContainerInstanceLog cmdlet gets the logs of a container in a container group.
Examples
Example 1: Get the tail log of a container instance
PS C:\> Get-AzureRmContainerInstanceLog -ResourceGroupName demo -ContainerGroupName mycontainer -Name container1
Log line 1.
Log line 2.
Log line 3.
Log line 4.
Get the log from container1
in container group mycontainer
. By default, it will return up to 4MB log content.
Example 2: Get the tail log of a container instance that has the same name as the container group
PS C:\> Get-AzureRmContainerInstanceLog -ResourceGroupName demo -ContainerGroupName mycontainer
Log line 1.
Log line 2.
Log line 3.
Log line 4.
Get the log from mycontainer
in container group mycontainer
. By default, it will return up to 4MB log content.
Example 3: Get the tail 2 lines of log of a container instance
PS C:\> Get-AzureRmContainerInstanceLog -ResourceGroupName demo -ContainerGroupName mycontainer -Name container1 -Tail 2
Log line 3.
Log line 4.
Get the tail 2 lines of log from container1
in container group mycontainer
.
Example 4: Get the tail log of a container instance in a piped in container group
PS C:\> Get-AzureRmContainerGroup -ResourceGroupName demo -Name mycontainer | Get-AzureRmContainerInstanceLog
Log line 1.
Log line 2.
Log line 3.
Log line 4.
Get the log from mycontainer
in piped in container group mycontainer
. By default, it will return up to 4MB log content.
Parameters
-ContainerGroupName
The container group name.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputContainerGroup
The input container group object.
Type: | PSContainerGroup |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
The container instance name in the container group. Default: the same as the container group name
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
The resource group name.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceId
The resource id.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Tail
The number of lines to tail the log. If not specify, the cmdlet will return up to 4MB tailed log
Type: | Nullable<T>[Int32] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Parameters: InputContainerGroup (ByValue)