ContainerGroupResource.GetContainerLogsAsync Method

Definition

Get the logs for a specified container instance in a specified resource group and container group.

  • Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs
  • Operation Id: Containers_ListLogs
  • Default Api Version: 2024-05-01-preview
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.ContainerInstance.Models.ContainerLogs>> GetContainerLogsAsync (string containerName, int? tail = default, bool? timestamps = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetContainerLogsAsync : string * Nullable<int> * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.ContainerInstance.Models.ContainerLogs>>
override this.GetContainerLogsAsync : string * Nullable<int> * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.ResourceManager.ContainerInstance.Models.ContainerLogs>>
Public Overridable Function GetContainerLogsAsync (containerName As String, Optional tail As Nullable(Of Integer) = Nothing, Optional timestamps As Nullable(Of Boolean) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of ContainerLogs))

Parameters

containerName
String

The name of the container instance.

tail
Nullable<Int32>

The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb.

timestamps
Nullable<Boolean>

If true, adds a timestamp at the beginning of every line of log output. If not provided, defaults to false.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

containerName is an empty string, and was expected to be non-empty.

containerName is null.

Applies to