All Projects → rpgreen → Apilogs

rpgreen / Apilogs

Licence: other
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Apilogs

Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-76.39%)
Mutual labels:  api, api-gateway, aws, aws-lambda, lambda, logging
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+3806.94%)
Mutual labels:  api, api-gateway, aws, aws-lambda, lambda
Lambdalogs
A CLI tool to trace AWS Lambda calls over multiple CloudWatch log groups.
Stars: ✭ 18 (-91.67%)
Mutual labels:  aws, aws-lambda, lambda, logging
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (-33.8%)
Mutual labels:  aws, aws-lambda, lambda, aws-apigateway
Serverless Next.js
⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+1278.24%)
Mutual labels:  api-gateway, aws, aws-lambda, lambda
Aws Serverless Java Container
A Java wrapper to run Spring, Jersey, Spark, and other apps inside AWS Lambda.
Stars: ✭ 1,054 (+387.96%)
Mutual labels:  api, api-gateway, aws, aws-lambda
Aws Lambda Fastify
Insipired by aws-serverless-express to work with Fastify with inject functionality.
Stars: ✭ 190 (-12.04%)
Mutual labels:  api, api-gateway, aws, lambda
Chalice
Python Serverless Microframework for AWS
Stars: ✭ 8,513 (+3841.2%)
Mutual labels:  aws, aws-lambda, lambda, aws-apigateway
Mangum
AWS Lambda & API Gateway support for ASGI
Stars: ✭ 475 (+119.91%)
Mutual labels:  api-gateway, aws, aws-lambda, lambda
Node Lambda Log
Basic logging mechanism for Node 6.10+ Lambda Functions
Stars: ✭ 115 (-46.76%)
Mutual labels:  aws, aws-lambda, lambda, logging
Archive aws Lambda Go Net
Network I/O interface for AWS Lambda Go runtime.
Stars: ✭ 151 (-30.09%)
Mutual labels:  aws, aws-lambda, aws-apigateway
Awsmobile Cli
CLI experience for Frontend developers in the JavaScript ecosystem.
Stars: ✭ 147 (-31.94%)
Mutual labels:  aws, aws-lambda, aws-apigateway
Serverless Sinatra Sample
Demo code for running Ruby Sinatra on AWS Lambda
Stars: ✭ 195 (-9.72%)
Mutual labels:  api-gateway, aws-lambda, lambda
Aws Mobile React Native Starter
AWS Mobile React Native Starter App https://aws.amazon.com/mobile
Stars: ✭ 2,247 (+940.28%)
Mutual labels:  api-gateway, aws, lambda
Spark On Lambda
Apache Spark on AWS Lambda
Stars: ✭ 137 (-36.57%)
Mutual labels:  aws, aws-lambda, lambda
Aws Maintenance Lambda
A lambda function to send alerts (to Slack, HipChat) on AWS maintenance events.
Stars: ✭ 133 (-38.43%)
Mutual labels:  aws, aws-lambda, lambda
Zappa
Serverless Python
Stars: ✭ 11,859 (+5390.28%)
Mutual labels:  api-gateway, aws-lambda, lambda
Aws Lambda Power Tuning
AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.
Stars: ✭ 3,040 (+1307.41%)
Mutual labels:  aws, aws-lambda, lambda
Dialetus Service
API to Informal dictionary for the idiomatic expressions that each Brazilian region It has
Stars: ✭ 202 (-6.48%)
Mutual labels:  api, aws, aws-lambda
Tenso
Tenso is an HTTP REST API framework
Stars: ✭ 167 (-22.69%)
Mutual labels:  api, api-gateway, gateway

apilogs

apilogs is a fork of the excellent awslogs <https://github.com/jorgebastida/awslogs>_ project with specific customizations suited to querying and streaming logs for Serverless APIs using Amazon API Gateway <https://aws.amazon.com/api-gateway/>_ and AWS Lambda <https://aws.amazon.com/lambda/>_.

Simply provide an API Gateway API ID and Stage name and apilogs will automatically aggregate log events from all log streams for your API Gateway API as well as all Lambda function log streams attached to your API.

Installation/Running

$ pip install apilogs

i.e. stream logs for your Serverless API: $ apilogs get --api-id xyz123 --stage prod --watch

Grep for errors one hour ago using credentials from AWS CLI profile "myprofile": $ apilogs get --api-id xyz123 --stage test2 --profile myprofile --aws-region us-east-1 --start='2h ago' --end='1h ago' | grep "ERROR"

.. image:: https://github.com/rpgreen/apilogs/blob/master/media/apilogs-screenshot.png

Features

  • Aggregate logs from across streams.

    • Aggregate all streams in a group.
    • Aggregate streams matching a regular expression.
  • Colored output.

    • Highlight found text in logs
  • List existing groups

    • $ apilogs groups
  • List existing streams

    • $ apilogs streams /var/log/syslog
  • Watch logs as they are created

    • $ apilogs get /var/log/syslog ALL --watch
  • Human-friendly time filtering:

    • --start='23/1/2015 14:23'
    • --start='2h ago'
    • --start='2d ago'
    • --start='2w ago'
    • --start='2d ago' --end='1h ago'
  • Retrieve event metadata:

    • --timestamp Prints the creation timestamp of each event.
    • --ingestion-time Prints the ingestion time of each event.

Options

  • apilogs groups: List existing groups

  • apilogs streams GROUP: List existing streams withing GROUP

  • apilogs get GROUP [STREAM_EXPRESSION]: Get logs matching STREAM_EXPRESSION in GROUP.

    • Expressions can be regular expressions or the wildcard ALL if you want any and don't want to type .*.

Note: You need to provide to all these options a valid AWS region using --aws-region or AWS_REGION env variable.

Time options

While querying for logs you can filter events by --start -s and --end -e date.

  • By minute:

    • --start='2m' Events generated two minutes ago.
    • --start='1 minute' Events generated one minute ago.
    • --start='5 minutes' Events generated five minutes ago.
  • By hours:

    • --start='2h' Events generated two hours ago.
    • --start='1 hour' Events generated one hour ago.
    • --start='5 hours' Events generated five hours ago.
  • By days:

    • --start='2d' Events generated two days ago.
    • --start='1 day' Events generated one day ago.
    • --start='5 days' Events generated five days ago.
  • By weeks:

    • --start='2w' Events generated two week ago.
    • --start='1 week' Events generated one weeks ago.
    • --start='5 weeks' Events generated five week ago.
  • Using specific dates:

    • --start='23/1/2015 12:00' Events generated after midday on the 23th of January 2015.
    • --start='1/1/2015' Events generated after midnight on the 1st of January 2015.
    • --start='Sat Oct 11 17:13:46 UTC 2003' You can use detailed dates too.

    Note, for time parsing awslogs uses dateutil <https://dateutil.readthedocs.org/en/latest/>_.

  • All previous examples are applicable for --end -e too.

Filter options

You can use --filter-pattern if you want to only retrieve logs which match one CloudWatch Logs Filter pattern. This is helpful if you know precisely what you are looking for, and don't want to download the entire stream.

For example, if you only want to download only the report events from a Lambda stream you can run::

$ apilogs get my_lambda_group --filter-pattern="[r=REPORT,...]"

Full documentation of how to write patterns: http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/FilterAndPatternSyntax.html

Contribute

  • Fork the repository on GitHub.

  • Write a test which shows that the bug was fixed or that the feature works as expected.

    • Use tox command to run all the tests in all locally available python version.
  • Send a pull request and bug the maintainer until it gets merged and published. :).

For more instructions see TESTING.rst.

Helpful Links

How to provide AWS credentials to apilogs

Although, the most straightforward thing to do might be use --aws-access-key-id and --aws-secret-access-key or --profile, this will eventually become a pain in the ass.

  • If you only have one AWS account, my personal recommendation would be to configure aws-cli <http://aws.amazon.com/cli/>_. apilogs will use those credentials if available.
  • If you have multiple AWS accounts or you don't want to setup aws-cli, I would recommend you to use envdir <https://pypi.python.org/pypi/envdir>_ in order to make AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY available to apilogs.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].