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

pm2-papertrail-logger

v2.0.0

Published

A simple and efficient PM2 module that forwards logs to Papertrail.

Downloads

457

Readme

PM2 Papertrail Logger

Maintained License

A simple and efficient PM2 module that forwards logs for all your PM2 processes to Papertrail:

  • ⚡️ Fast and lightweight, unpacked size of 45kb!
  • 🔒 Secure with all logs sent over TLS
  • 🔧 Easy to install and configure, deployed with 3 easy commands within a matter of seconds!
  • 📝 Adjustable hostname for your pm2 source
  • 🚀 Supports all PM2 process modes, including cluster, fork, and standalone.
  • 📦 Memory management and automatic cleanup for closed processes

Prerequisites

PM2

This module requires that you have PM2 installed and running on your system. If you do not have PM2 installed, you can install it via NPM:

npm install pm2 -g

Papertrail

In order to use this module and forward all your pm2 process logs, you must have a Papertrail Standalone account, this will not work for Papertrail instances that are attached as an addon to a Heroku application. For information on setting up a Papertrail Standalone account, click here.

Within your Papertrail account, you will need a Log Destination that accepts connections via TCP/UDP Ports. Once this is setup, take note of your destination host (*.papertrailapp.com) and port number.

Installation & Setup

  1. Install the module via pm2:
pm2 install pm2-papertrail-logger

[!IMPORTANT]
Use pm2 install, not npm install!

  1. Configure the Papertrail log destination by providing your host and port number:
pm2 set pm2-papertrail-logger:host <host>
pm2 set pm2-papertrail-logger:port <port>
  1. The module should restart and begin logging to Papertrail!

Usage

Once the module is installed and configured, it will automatically begin logging all your PM2 processes to Papertrail. You can view the logs by clicking on the Events tab within your Papertrail account.

By default, the host name sent to Papertrail will be the OS hostname, you can change this by setting the hostname configuration variable:

pm2 set pm2-papertrail-logger:hostname <hostname>

PM2 Metrics

This module also provides metrics that can be viewed within the PM2 dashboard. | Metric | Description | | --- | --- | | Attached Processes | The number of processes that are currently transporting logs to Papertrail. |

Uninstalling

To uninstall the module, simply run:

pm2 uninstall pm2-papertrail-logger

This will remove the module from your PM2 configuration and stop it from running, you may also want to remove the configuration variables that were set:

pm2 unset pm2-papertrail-logger:host
pm2 unset pm2-papertrail-logger:port
pm2 unset pm2-papertrail-logger:hostname