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

log-email-alerts

v2.1.0

Published

This is a node.js script which alerts on new line occurrence in a log file. We made this to use as a companion with PM2. It can be used for reporting and alerts.

Downloads

10

Readme

log-email-alerts

NPM

This is a node.js package which alerts on any new line occurrence in a log file (or any text file). Its use cases be - getting notified for an error or warning occurance in your log file on some server or sending report from a file when a new data is added. In our case we mostly used it with PM2 to alert us whenever a script fails.

User can customize the number of lines to send from the log file and also the delay between between two alerts.

##Setup

  1. do npm install log-email-alerts.
  2. require the module in your app.
  3. set configuration as your desire as a JSON.
  4. call the function with config as a parameter.

##Example

    var logEmailAlerts = require('log-email-alerts');
    var config = {
        file_array : ['abc.log', '/var/some/thing.log']
        ,alerts_to_email : "[email protected]"
        ,alerts_from_email : "[email protected]"
        ,keywords : [/findme/g, 'FindMe']
        ,no_more_emails_till_mili_sec:7200000
        ,collect_lines_till_mili_sec:10000
        ,max_lines_to_collect:10
    };
    logEmailAlerts(config);

##Settings Following are the things that you can set in the config object.

  • file_array : This array contains path to the log files for which you want to set alert.
  • alerts_to_email : It is the email to which alerts are send.
  • keywords : This array contains the keyword/regex, occunace of any will send mail alert.
  • alerts_from_email : It is the email which is used in from field of the sent mails.
  • no_more_emails_till_mili_sec : How much delay do you want in between alerts. Useful in case your files gets suddenly flooded.
  • collect_lines_till_mili_sec : Ones a new line occurs in file then for how many mili seconds should the program keep on collecting the lines before it sends them in an alert.
  • max_lines_to_collect : How many minimum number of lines should the program collect before sending an alert.