Menu
Amazon Elastic Container Service
Developer Guide (API Version 2014-11-13)

ecs-cli logs

Description

Retrieves container logs from CloudWatch Logs. Only valid for tasks that use the awslogs driver and have a log stream prefix specified.

Syntax

ecs-cli logs --task-id task_id [--task-def task_definition] [--follow] [--filter-pattern search_string] [--since n_minutes] [--start-time 2006-01-02T15:04:05+07:00] [--end-time 2006-01-02T15:04:05+07:00] [--timestamps] [--help]

Options

Name Description

--cluster, -c cluster_name

Specifies the ECS cluster name to use. Defaults to the cluster configured using the configure command.

Type: String

Required: No

--region, -r region

Specifies the AWS region to use. Defaults to the cluster configured using the configure command.

Type: String

Required: No

--task-id task_id

Prints the logs for this ECS task.

Type: String

Required: Yes

--task-def task_definition

Specifies the name or full Amazon Resource Name (ARN) of the ECS task definition associated with the task ID. This is only needed if the task has been stopped.

Type: String

Required: No

--follow

Specifies if the logs should be streamed.

Required: No

--filter-pattern search_string

Specifies the substring to search for within the logs.

Type: String

Required: No

--since n

Returns logs newer than a relative duration in minutes. Can't be used with --start-time.

Type: Integer

Required: No

--start-time timestamp

Returns logs after a specific date (format: RFC 3339. Example: 2006-01-02T15:04:05+07:00). Cannot be used with --since flag.

Required: No

--end-time timestamp

Returns logs before a specific date (format: RFC 3339. Example: 2006-01-02T15:04:05+07:00). Cannot be used with --follow.

Required: No

--timestamps

Specifies if time stamps are shown on each line in the log output.

Required: No

--cluster-config cluster_config_name

Specifies the name of the ECS cluster configuration to use. Defaults to the cluster configuration set as the default.

Type: String

Required: No

--ecs-profile ecs_profile

Specifies the name of the ECS profile configuration to use. Defaults to the profile configured using the configure profile command.

Type: String

Required: No

--aws-profile aws_profile

Specifies the AWS profile to use. Enables you to use the AWS credentials from an existing named profile in ~/.aws/credentials.

Type: String

Required: No

--help, -h

Shows the help text for the specified command.

Required: No

Examples

Example

This example prints the log for a task.

ecs-cli logs --task-id task_id

The contents of the log is in the output if successful.