npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-log-forwarding

v3.2.0

Published

a serverless plugin to forward logs to given lambda function

Downloads

29,035

Readme

serverless-log-forwarding

serverless MIT licensed Codacy Badge Build Status npm version npm downloads

Serverless plugin for forwarding CloudWatch logs to another Lambda function.

About Amplify

Amplify builds innovative and compelling digital educational products that empower teachers and students across the country. We have a long history as the leading innovator in K-12 education - and have been described as the best tech company in education and the best education company in tech. While others try to shrink the learning experience into the technology, we use technology to expand what is possible in real classrooms with real students and teachers.

Getting Started

Prerequisites

Make sure you have the following installed before starting:

Installing

To install the plugin, run:

npm install serverless-log-forwarding

Then make the following edits to your serverless.yaml file:

plugins:
  - serverless-log-forwarding

custom:
  logForwarding:
    destinationARN: '[ARN of Lambda Function to forward logs to]'
    # optional:
    roleArn: '[ARN of the IAM role that grants Cloudwatch Logs permissions]'
    filterPattern: '[filter pattern for logs that are sent to Lambda function]'
    normalizedFilterID: true # whether to use normalized function name as filter ID
    stages:
      - '[name of the stage to apply log forwarding]'
      - '[another stage name to filter]'
    createLambdaPermission: true # whether to create the AWS::Lambda::Permission for the destinationARN (when policy size limits are a concern)

functions:
  myFunction:
    handler: src/someHandler
    # optional properties for per-function configuration:
    logForwarding:
      # set enabled to false to disable log forwarding for a single given function
      enabled: false

Running Tests

To run unit tests:

npm run test

For running integration tests you will need to log into you AWS account and set AWS_PROFILE environment variable, it will be used to create AWS entities for testing purposes

export AWS_PROFILE=<profile_name>

npm run integration-test

All tests should pass. All unit tests should pass before merging. Integration tests will probably take some time

If there is an error update the node_modules inside the root folder of the directory:

npm install

Writing Integration Tests

Unit tests are found in test/unit-tests. Integration tests are found in test/integration-tests.

test/integration-tests contains configs folder, for every test there is a folder with serverless.yml configuration and logs_producer.py.

To add another test create a folder for your test with the folder name that corresponds to test name and add code to run test to test/integration-tests/integration-tests.ts

Deploying


The plugin will be packaged with the lambda when deployed as normal using Serverless:

serverless deploy

Responsible Disclosure

If you have any security issue to report, contact project maintainers privately. You can reach us at [email protected]

Contributing

We welcome pull requests! For your pull request to be accepted smoothly, we suggest that you:

  1. For any sizable change, first open a GitHub issue to discuss your idea.
  2. Create a pull request. Explain why you want to make the change and what it’s for. We’ll try to answer any PRs promptly.