Sign inSign up

rlauer/aws-logs

By rlauer

•Updated about 4 hours ago

Log::Log4perl::Appender::CloudWatchLogs and aws-logs command

Image
0

37

rlauer/aws-logs repository overview

⁠Overview

aws-logs is a command-line tool for working with Amazon CloudWatch Logs.

It is distributed as part of Log::Log4perl::Appender::CloudWatchLogs and provides a convenient way to inspect, follow, and manage CloudWatch log groups and streams without installing the Perl distribution and its dependencies locally.

The container includes aws-logs together with the generated Amazon::API::CloudWatchLogs service class required to communicate with AWS.

Typical uses include:

  • listing CloudWatch log groups and streams
  • retrieving recent log events
  • following multiple active log streams
  • automatically discovering new Lambda log streams while following
  • identifying the most recently active stream
  • pruning stale log stream resources

For example:

docker run --rm \
  -v "$HOME/.aws:/root/.aws:ro" \
  -e AWS_PROFILE \
  -e AWS_REGION \
  openbedrock/aws-logs \
  aws-logs list-groups

Follow the logs for a Lambda function:

docker run --rm \
  -v "$HOME/.aws:/root/.aws:ro" \
  -e AWS_PROFILE \
  -e AWS_REGION \
  openbedrock/aws-logs \
  aws-logs -g /aws/lambda/my-function -t 30m --follow get-stream

aws-logs periodically rediscovers streams while following, allowing it to pick up new Lambda execution environments after the command has already started.

It can also remove stale log streams whose events have already aged out:

docker run --rm \
  -v "$HOME/.aws:/root/.aws:ro" \
  -e AWS_PROFILE \
  -e AWS_REGION \
  openbedrock/aws-logs \
  aws-logs -g /aws/lambda/my-function prune-streams 30d

Use --dryrun to preview which streams would be removed.

For help:

docker run --rm openbedrock/aws-logs aws-logs -h

The underlying Perl distribution is available as Log::Log4perl::Appender::CloudWatchLogs.

Tag summary

Content type

Image

Digest

sha256:9300ab827…

Size

50 MB

Last updated

about 4 hours ago

docker pull rlauer/aws-logs