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 🙏

© 2026 – Pkg Stats / Ryan Hefner

serverless-logs-insights

v0.5.4

Published

Serverless Framework plugin to run AWS CloudWatch Logs Insights queries directly from the CLI.

Downloads

50

Readme

Serverless Logs Insights

Plugin for the Serverless Framework that simplifies advanced queries in AWS CloudWatch Logs Insights directly through the CLI, allowing you to filter, analyze, and visualize Lambda function logs in a practical and efficient way.

Installation

Add the plugin to your Serverless project:

npm install --save-dev serverless-logs-insights

Configuration

In your serverless.yml file, add the plugin and configure custom queries under custom.logsInsights.queries:

plugins:
  - serverless-logs-insights

custom:
  logsInsights:
    queries:
      errors: "fields @timestamp, @message | filter @message like /error/ | sort @timestamp desc | limit 20"
      warnings: "fields @timestamp, @message | filter @message like /warn/ | sort @timestamp desc | limit 20"

Queries can be customized according to your needs, using the CloudWatch Logs Insights syntax.

Usage

Run queries directly through the Serverless Framework CLI:

sls logs-insights -f <function> -q <query> [-i <interval>] [-o <output>] [--relative-time]

Available Options

| Option | Description | | --- | --- | | -f, --function | Name of the Lambda function (as defined in serverless.yml) | | -q, --query | Name of the query defined in custom.logsInsights.queries or a free query | | -i, --interval | Time interval (default: 1h). Supports s, m, h, d | | -o, --output | Output format: auto (default), table, json, raw | | --relative-time | Show timestamps as relative (e.g. 2m ago) |

Examples

Query the latest errors of a Lambda function named hello:

sls logs-insights -f hello -q errors

Run a custom query directly via CLI:

sls logs-insights -f hello -q "fields @message | filter @message like /timeout/" -i 3h

Force table output:

sls logs-insights -f hello -q errors -o table

JSON output for piping to other tools:

sls logs-insights -f hello -q errors -o json

Output Features

  • Log level colorsERROR in red, WARN in yellow, INFO in cyan, DEBUG in gray
  • Progress indicator — shows elapsed time while the query is running
  • Query statistics — displays bytes scanned, records matched, and query duration
  • Auto layout — log view for @timestamp + @message queries, table view for multi-field queries
  • JSON detection — automatically pretty-prints JSON payloads inside log messages

How does it work?

The plugin uses the AWS SDK to execute queries in CloudWatch Logs Insights, retrieving events from the log groups associated with the Lambda functions in your Serverless project. Results are displayed directly in the terminal with color-coded log levels, structured table views, and query statistics.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Developed by Kauê Leal - github.com/kauelima21