logr-watch

1.0.7 • Public • Published

logr-watch

Watch log files and push it to Logr.

Usage

-h, --help                 output usage information
-v, --version              output the version number
-c, --config <path>        path to config file
init                       create config file
help                       output usage information

Getting started

npm i logr-watch -g
logrw init
logrw

Config

// logrw.config.js
module.exports = {
  udp: ":7776",
  public_key: "MCAwDQYJKoZIhvcNAQEBBQADDwAwDAIFAMg7IrMCAwEAAQ==",
  private_key: "MC0CAQACBQDIOyKzAgMBAAECBQCHaZwRAgMA0nkCAwDziwIDAL+xAgJMKwICGq0=",
  files: [
    // watch file
    {
      path: "/var/log/system.log",
    },
    // filter messages at error level and above
    {
      path: "/var/log/nginx/nginx_error.log",
      level: "error",
    },
    // watch multiple files, and log it under the name
    {
      path: "./*.txt",
      logname: "test.txt",
    },
    // using a custom parser
    {
      path: "./.pm2/logs/myapp*.log",
      logname: "myapp.pm2.log",
      parser() {
        return ({ message }) => {
          const match = /(.+?)\s+(.+?)\s+(.+)/.exec(message);
          if (match === null) {
            return null;
          }
          return {
            timestamp: match[1],
            level: match[2],
            message: match[3],
          };
        };
      },
    },
  ],
};

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.72latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.72
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i logr-watch

Weekly Downloads

2

Version

1.0.7

License

ISC

Unpacked Size

6.05 kB

Total Files

6

Last publish

Collaborators

  • kozhurkin