Skip to main content

A handy CLI to help you gather Lambda Functions logs

Project description

AWS Lambda Log Collector

If you usually find yourself trying to debug AWS Lambda Functions and getting lost when trying to search for logs, this CLI is meant for you.

Imagine your Lambda Function had an invocation error spike during last night. Today after arriving at your company you need to troubleshoot that error spike. You usually need to open CloudWatch Logs console and start to scroll infinitely through the Log Streams, even worse if the Lambda Function has millions of invocations daily.

This CLI will help you to gather all the useful CloudWatch Logs from a Lambda Function, with a single command while you can go for your morning coffee.

Why?

Because you can search for a subset of the these logs providing a start and end time, and even better you can also provide a CloudWatch Logs Filter Pattern. Making it easier to find what you are looking for!

Usage

Usage: aws-lambda-log-collector [OPTIONS]

Options:
  --version                       Show the version and exit.
  -f, --function-name TEXT        i.e. HelloWorld  [required]
  -p, --profile TEXT              AWS profile name (i.e. dev)  [required]
  -r, --region TEXT               AWS region (i.e. eu-west-1)  [required]
  -o, --output PATH               i.e. /tmp/  [required]
  -s, --start-time TEXT           2019-10-30T12:00:00  [required]
  -e, --end-time TEXT             2019-10-31T12:00:00  [required]
  --pattern TEXT                  ERROR  [required]
  --log-level [INFO|ERROR|DEBUG]  logging level
  --help                          Show this message and exit.

Parameters

--function-name || -f

The desired Lambda Function Name you want to retrieve logs from.

--start-time || -s

The start of the time range where the CLI search for logs, CloudWatch Logs with a timestamp before this time are not returned.

Pattern: YYYY-mm-ddThh:MM:ss

--end-time || -e

The end of the time range where the CLI search for logs, CloudWatch Logs with a timestamp after this time are not returned.

Pattern: YYYY-mm-ddThh:MM:ss

--pattern

The filter pattern to use while searching for logs content. You can use CloudWatch Logs Filter and Pattern Syntax.

--output || -o

The output path where the CLI will store the logs.

--region || -r

The AWS Region where you Lambda Function belongs to.

--profile || -p

A configured aws profile.

Installation

From pip

pip install aws-lambda-log-collector

From source

git clone https://github.com/mvinii94/aws-lambda-log-collector && cd aws-lambda-log-collector

pip install -e .

Sample

aws-lambda-log-collector --function-name MyFunction \
--start-time 2019-11-10T23:30:00 --end-time 2019-11-11T03:30:00 \
--pattern "ERROR" --output /tmp/ --region eu-west-1 --profile dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-lambda-log-collector-0.0.4.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

aws_lambda_log_collector-0.0.4-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file aws-lambda-log-collector-0.0.4.tar.gz.

File metadata

  • Download URL: aws-lambda-log-collector-0.0.4.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for aws-lambda-log-collector-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f918eded0fa8b106efb7a79cb1cbffb81aed2d7b2b41fa234256bce7d726e002
MD5 3e33c79c3e884fa629c09cfa3955ec3f
BLAKE2b-256 0693b087a5d6f4c2cdffe84796a88bbf66134aa8ef2199a1a01ef22696299379

See more details on using hashes here.

File details

Details for the file aws_lambda_log_collector-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: aws_lambda_log_collector-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for aws_lambda_log_collector-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4d0aba32a0d4261e3b789958eeca04cd322e18f4f61e25c766b3ca54a9a57504
MD5 ffa4cca4a2be9cc42b8f22a8cfac6ee4
BLAKE2b-256 4d9480a530a521edd893e66679394d83e69f26e7111d9cb191dbb3c02d5e0e22

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page