Glossy Syslog Parser and Producer

0.1.7 · abandoned · verified Sun Apr 19

Glossy is a lightweight JavaScript library designed for parsing and producing raw syslog messages. It supports multiple RFC standards including RFC 3164, RFC 5424, and RFC 5848. The library is unique in that it performs no network interactions itself, leaving the integration with UDP or TCP to the developer. It boasts zero external dependencies and was designed to be operable in various JavaScript environments, including browsers, in addition to Node.js. The current stable version, 0.1.7, was published 11 years ago, indicating an abandoned status. Its primary differentiators were its RFC compliance, dependency-free nature, and flexibility in deployment, though its age now presents significant compatibility challenges with modern JavaScript ecosystems.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates setting up a UDP server to listen for incoming syslog messages on port 514 and parse them using `glossy.Parse`. It logs the host and message content of each parsed syslog entry.

const { Parse } = require('glossy');
const dgram = require('dgram');

const server = dgram.createSocket('udp4');

server.on('message', function(rawMessage) {
    // rawMessage is a Buffer, convert it to a UTF-8 string
    Parse.parse(rawMessage.toString('utf8', 0), function(parsedMessage){
        console.log(`Received syslog from ${parsedMessage.host} - Message: ${parsedMessage.message}`);
    });
});

server.on('listening', function() {
    const address = server.address();
    console.log(`Syslog server listening on ${address.address}:${address.port}`);
});

// Note: Binding to ports < 1024 often requires elevated privileges (e.g., sudo/root).
// For non-root operation, use a port >= 1024.
server.bind(514, '0.0.0.0', () => {
    console.log('Attempting to bind UDP server to port 514');
});

view raw JSON →