← 返回命令列表

Linux command

awslogs 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Stream

awslogs get [/aws/lambda/my-function] --watch

Example

awslogs get [/aws/lambda/my-function] --start='[2h ago]'

Filter

awslogs get [/aws/lambda/my-function] --filter-pattern '[ERROR]'

List

awslogs groups

List

awslogs streams [/aws/lambda/my-function]

说明

awslogs is a command-line tool for querying and streaming AWS CloudWatch Logs. It provides a simple interface for viewing logs from Lambda functions, EC2 instances, ECS containers, and other AWS services. The tool offers real-time log streaming and time-based filtering without using the AWS Console.

参数

get _log-group_
Fetch logs from log group
groups
List available log groups
streams _log-group_
List streams in log group
--watch, -w
Stream logs in real-time
--start=_time_
Start time (e.g., '2h ago', '2023-01-01')
--end=_time_
End time
--filter-pattern=_pattern_
CloudWatch filter pattern
--profile=_profile_
AWS profile to use
--region=_region_
AWS region
--no-group
Don't group streams together

FAQ

What is the awslogs command used for?

awslogs is a command-line tool for querying and streaming AWS CloudWatch Logs. It provides a simple interface for viewing logs from Lambda functions, EC2 instances, ECS containers, and other AWS services. The tool offers real-time log streaming and time-based filtering without using the AWS Console.

How do I run a basic awslogs example?

Run `awslogs get [/aws/lambda/my-function] --watch` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does get _log-group_ do in awslogs?

Fetch logs from log group