Nitrogenous Polymorphic Molecule

    rsyslog
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.2 • Public • Published

    rsyslog

    Sprays packets to a remote RFC5424 syslog, e.g. at Papertrail

    Relying on the defaults:

    const { RemoteSyslog, SEVERITY } = require('rsyslog');
    const rsyslog = new RemoteSyslog();
    rsyslog.once('error', err => { /* catch it, or Node will crash */ });
    rsyslog.send(SEVERITY.NOTICE, "I'm awake!");

    Specifying the results in full detail:

    const { RemoteSyslog, FACILITY, SEVERITY, NILVALUE } = require('rsyslog');
    const os = require('os');
    const rsyslog = new RemoteSyslog({
        target_host: '127.0.0.1', // syslog server's hostname
        target_port: 514, // syslog server's port
        hostname: os.hostname(), // sender's hostname
        facility: FACILITY.local0, // 'local0' would also do
        appname: NILVALUE,
        procid: process.pid,
    });
    rsyslog.once('error', err => { /* catch it, or Node will crash */ });
    rsyslog.send(SEVERITY.NOTICE, "I'm awake!", {
        timestamp: Date.now(),
        syslog_msgid: NILVALUE,
    });

    RFC5424 Details

    • All HEADER fields get reasonable defaults
    • The MSG is always UTF-8 encoded
    • STRUCTURED-DATA is not yet supported
    • You should read the section on message length
    • FACILITY, SEVERITY, and NILVALUE are exported for your convenience

    Change Log

    1.1.1: fix scheduling problem revealed by buf.byteLength crasher

    1.1.0: fix awful spec violation (missing STRUCTURED-DATA); add procid option

    Install

    npm i rsyslog

    DownloadsWeekly Downloads

    5

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    93.6 kB

    Total Files

    14

    Last publish

    Collaborators

    • garthk