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

@mhlabs/cwlogs-cli

v1.0.2

Published

CLI tool to quickly set up cross log group search in CloudWatch Logs Insights based on prefix, tags and/or RegEx pattern

Downloads

11

Readme

CWLogs CLI

CloudWatch Insights Logs is a great way to search your CloudWatch logs. Often you want to search across many log groups to, for example, tracing a correlation id across multiple services. CloudWatch Logs Insights lets you search across up to 20 log groups in one query, but adding log groups from the dropdown is a bit cumbersome.

This tool lets you generate and open a CloudWatch Logs Insights URL with your desired log groups pre-added.

Installation

npm i -g @mhlabs/cwlogs-cli

Usage

$ cwlogs insights --help
Usage: cwlogs insights|i [options]

Opens a CloudWatch Logs console with multiple log groups matching a tag or prefix

Options:
  -t, --tag [tag]        Tag to filter on. Format: tagName:value1,value2. Optional. If omitted you will get
                         prompted by available tags (default: false)
  -p, --prefix [prefix]  Log group prefix. I.e /aws/lambda/. The more granular this is specified, the faster the
                         command will run
  --pattern [pattern]    Regex pattern used to filter the log group names
  --region [region]      AWS region. Defaults to environment variable AWS_REGION
  --profile [profile]    AWS profile. Defaults to en

You can either use --tag or --prefix to group log groups

By tag (Lambda logs only)

Command: cwlogs insights --tag <tag?> [options]

Example 1: Query logs from lambda functions tagged with team:ecommerce that has the word Api in its name cwlogs insights --tag team:ecommerce --pattern Api

Example 2: Query logs from lambda functions by cloudformation stack name tag using the guided menu Demo

By log group prefix

Command: cwlogs insights --prefix <prefix> [options]

Example: Query all RDS clusters' error logs cwlogs insights --prefix /aws/rds/cluster --pattern \/error$ Demo

Known limitations

CloudWatch Logs Insights currently only allows up to 20 log groups in one query. The total number of characters (query + log groups) may bot exceed 10000 characters.