Skip to main content

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

Release files for aws-lambda-log-collector 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-lambda-log-collector 0.0.9
File Size Uploaded
aws-lambda-log-collector-0.0.9.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-lambda-log-collector 0.0.9
File Interpreter ABI Platform
aws_lambda_log_collector-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / aws-lambda-log-collector-0.0.9.tar.gz

Download URL aws-lambda-log-collector-0.0.9.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f45acd41d3bc9c7d73b1d6a78cc471f3c88e5a3f559f696a5e7426478d614805
BLAKE2b-256 checksum
How to use checksums
2875ab6077893e50079b86f699de4445edee3d0fee8074f4134cf054d98f256d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.3

Release files / aws_lambda_log_collector-0.0.9-py3-none-any.whl

Download URL aws_lambda_log_collector-0.0.9-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26283c6d86f2297dd899ba31828c35ed365f173d93a258e8d8df70a0daa81e2e
BLAKE2b-256 checksum
How to use checksums
9d90251fe5f97c22e2a003f63fce880113768d37b2c71f84ade23b12ca26b963
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page