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

syslog-appender-pro

v1.0.2

Published

Syslog Appender for TCP/TLS/UDP connections

Downloads

9

Readme

About

The syslog protocol (rfc5424) client. Works with Node.js over udp (rfc5426), tcp (rfc6587) and tls (rfc5425)

Documentation

  1. Installation
  2. Usage
  3. Options
  4. Severity
  5. Facility

Installation

npm

npm install syslog-appender-pro --save

Usage

  1. TCP
const { Appender, FACILITIES, SEVERITIES, PROTOCOLS } = require('syslog-appender-pro');
const logger = new Appender({
    defaultAppName: 'syslog-appender-pro',
    defaultStructuredData: {
        '8bf8cc10-4140-4c3e-a2b4-e6f5324f1aea@41058': {
            tag: PROTOCOLS.TCP,
        },
    },
    host: 'logs-01.loggly.com',
    port: 514,
    protocol: PROTOCOLS.TCP,
    facility: FACILITIES.LOCAL0,
    severity: SEVERITIES.DEBUG
})

logger.debug({ message: 'Message from syslog-appender-pro!' })
    .then((result) => {
        console.log('Sent message on tcp');
    })
    .catch(console.error);
  1. TLS
const { Appender, FACILITIES, SEVERITIES, PROTOCOLS } = require('syslog-appender-pro');
const logger = new Appender({
    defaultAppName: 'syslog-appender-pro',
    caPath: '/etc/ssl/CA.crt',
    certificatePath: '/etc/ssl/client.crt',
    keyPath: '/etc/ssl/client.key',
    defaultStructuredData: {
        '8bf8cc10-4140-4c3e-a2b4-e6f5324f1aea@41058': {
            tag: PROTOCOLS.TLS,
        },
    },
    host: 'logs-01.loggly.com',
    port: 514,
    protocol: PROTOCOLS.TLS,
    facility: FACILITIES.LOCAL0,
    severity: SEVERITIES.DEBUG
})

logger.debug({ message: 'Message from syslog-appender-pro!' })
    .then((result) => {
        console.log('Sent message on tcp');
    })
    .catch(console.error);
  1. UDP
const { Appender, FACILITIES, SEVERITIES, PROTOCOLS } = require('syslog-appender-pro');
const logger = new Appender({
    defaultAppName: 'syslog-appender-pro',
    defaultStructuredData: {
        '8bf8cc10-4140-4c3e-a2b4-e6f5324f1aea@41058': {
            tag: POTOCOLS.UDP,
        },
    },
    host: 'logs-01.loggly.com',
    port: 514,
    protocol: PROTOCOLS.UDP,
    facility: FACILITIES.LOCAL0,
    severity: SEVERITIES.DEBUG
})

logger.debug({ message: 'Message from syslog-appender-pro!' })
    .then((result) => {
        console.log('Sent message on udp');
    })
    .catch(console.error);

Options

Server Options

  1. caPath Exact path to ca certificate. Default: ''.
  2. certificatePath Exact path to client certificate. Default: ''.
  3. keyPath Exact path to key file. Default: ''.
  4. host Doomain name or IP of host server. Defaut: 'localhost'.
  5. port Port of host server. Default: 514.
  6. hostname System hostname. Default: os.hostname().
  7. rejectUnauthorized If true, the server certificate is verified against the list of supplied CAs. An error event is emitted if verification fails. Default: false.
  8. protocol Protocol over which syslog is accepted by host server. Default: 'tcp'.

Appender Options

  1. defaultAppName Name of your application. Default: 'syslog-appender-pro'.
  2. defaultEol Default end of line for syslogs. Default: '\n'.
  3. defaultFacility Default Facility to be used for syslogs. Default: 'LOCAL0'.
  4. defaultSeverity Default severity to be used for syslogs. Default: 'DEBUG'.
  5. defaultStructuredData Default structured data if required for syslogs. Can be json format for logs, etc. Default: '-'.
  6. defaultMsgId Default msgId for the syslogs. Default: '-'.

Severity

  1. ALERT
  2. CRITICAL
  3. DEBUG
  4. EMERGENCY
  5. ERROR
  6. INFORMATIONAL
  7. NOTICE
  8. WARNING

Facility

  1. LOCAL0
  2. LOCAL1
  3. LOCAL2
  4. LOCAL3
  5. LOCAL4
  6. LOCAL5
  7. LOCAL6
  8. LOCAL7