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

winston-rsyslog2

v0.0.5

Published

Rsyslog transport for winston

Downloads

196

Readme

winston-rsyslog2

A Rsyslog transport for winston.

Usage

  var winston = require('winston');

  //
  // Requiring `winston-rsyslog` will expose 
  // `winston.transports.Rsyslog`
  //
  require('winston-rsyslog2');

  winston.add(winston.transports.Rsyslog, options);

This is a fork of winston-rsyslog version 0.0.2. See the CHANGELOG for differences.

The rsyslog transport takes the following options:

  • level: Level of messages that this transport should log
  • host: Host where rsyslog runs (default : localhost)
  • port: rsyslog Port (default : 514)
  • facility: Facility index (default is 0, valid values are from 0 to 23)
  • protocol: TCP or UDP (values can be "U" or "T", default is "U")
  • hostname: The hostname the application is running at (default is the current hostname)
  • tag: A tag to name the application for easy log filtering (default is 'winston')
  • timeout: Socket timeout for TCP (default is 2000 ms)
  • levelMapping: Mapping of level names to rsyslog security levels (defaults to winston.config.syslog.levelMapping)
  • dateProvider: A parameterless function that returns a date string (default is new Date().toISOString())
  • messageProvider: A function that returns the message string, takes three parameters: level, msg and meta (msg is already formatted by winston)

Through facility parameter, You'll be able to use the right log file on rsyslog:

0 :  kernel messages
1 :  user-level messages
2 :  mail system
3 :  system daemons
4 :  security/authorization messages
5 :  messages generated internally by syslogd
6 :  line printer subsystem
7 :  network news subsystem
8 :  UUCP subsystem
9 :  clock daemon
10 : security/authorization messages
11 : FTP daemon
12 : NTP subsystem
13 : log audit
14 : log alert
15 : clock daemon (note 2)
16 : local use 0 (local0)
17 : local use 1 (local1)
18 : local use 2 (local2)
19 : local use 3 (local3)
20 : local use 4 (local4)
21 : local use 5 (local5)
22 : local use 6 (local6)
23 : local use 7 (local7)

Enabling rsyslog

To let rsyslog receive data through UDP port, you should change its configuration (typically located in /etc/rsyslog.conf), enabling the following tags:

$ModLoad imudp
$UDPServerRun 514

The first tag enables UDP reception, while the second one defines the listening port.

To enable TCP reception on port 10514 (as an example):

$ModLoad imtcp
$InputTCPServerRun 10514

Installation

npm install winston-rsyslog2

Run Tests

All of the winston tests are written in vows, and cover all of the use cases described above. To configure the destination rsyslog daemon parameters, copy the test/config.example.json file into test/config.json and modify it to suite your needs. If no test/config.json file is found, defaults will be used.

Then you can run tests with npm:

npm test

Author: Fabio Grande

License: MIT