awslogs
Query and stream CloudWatch log groups from the terminal.
TLDR
SYNOPSIS
awslogs command [options] log-group
DESCRIPTION
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.
PARAMETERS
get log-group [stream-expression]
Fetch logs matching the optional stream expression from a log group.groups
List available log groups.streams log-group
List streams within a log group.--watch, -w
Watch logs as they are created (stream in real-time).--watch-interval, -i seconds
Interval in seconds to poll for new log events with --watch.--start time, -s time
Start time (e.g., '2h ago', '2023-01-01').--end time, -e time
End time.--filter-pattern pattern, -f pattern
CloudWatch Logs filter pattern.--query query, -q query
JMESPath-style query to extract fields from JSON log events.--timestamp
Print the timestamp of each event.--ingestion-time
Print the ingestion time of each event.--profile profile
AWS CLI profile to use.--aws-region region
AWS region (or set the AWS_REGION environment variable).--no-group, -G
Do not display the log group name.--no-stream, -S
Do not display the log stream name.
TIME SPECIFICATIONS
- 2h ago - 2 hours ago- 30m ago - 30 minutes ago- 2d ago - 2 days ago- 2023-01-01 - Specific date- 2023-01-01 10:30 - Specific datetime
INSTALL
CAVEATS
Requires AWS credentials configured. Large log queries may be slow. CloudWatch Logs costs apply. Time specifications are in UTC. --watch can consume API calls quickly.
HISTORY
awslogs was created by Jorge Bastida around 2015 to provide a better command-line experience for viewing CloudWatch Logs compared to the official AWS CLI.
