{"id":14600,"library":"glossy","title":"Glossy Syslog Parser and Producer","description":"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.","status":"abandoned","version":"0.1.7","language":"javascript","source_language":"en","source_url":"http://github.com/squeeks/glossy","tags":["javascript","syslog","logging"],"install":[{"cmd":"npm install glossy","lang":"bash","label":"npm"},{"cmd":"yarn add glossy","lang":"bash","label":"yarn"},{"cmd":"pnpm add glossy","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Glossy is a CommonJS module. Direct ESM imports like `import` are not supported without a transpiler or specific Node.js configuration for CJS interoperability.","wrong":"import { Parse } from 'glossy';","symbol":"Parse","correct":"const { Parse } = require('glossy');"},{"note":"The `Produce` class is a named export, not a default export. Ensure you destructure it from the `require` call.","wrong":"import Produce from 'glossy';","symbol":"Produce","correct":"const { Produce } = require('glossy');"},{"note":"Utility functions like `info` are exposed directly on the main `glossy` export, not as individual named exports.","wrong":"import { info } from 'glossy';","symbol":"glossy.info","correct":"const glossy = require('glossy');\nconst infoMsg = glossy.info({ message: 'Info Message' });"}],"quickstart":{"code":"const { Parse } = require('glossy');\nconst dgram = require('dgram');\n\nconst server = dgram.createSocket('udp4');\n\nserver.on('message', function(rawMessage) {\n    // rawMessage is a Buffer, convert it to a UTF-8 string\n    Parse.parse(rawMessage.toString('utf8', 0), function(parsedMessage){\n        console.log(`Received syslog from ${parsedMessage.host} - Message: ${parsedMessage.message}`);\n    });\n});\n\nserver.on('listening', function() {\n    const address = server.address();\n    console.log(`Syslog server listening on ${address.address}:${address.port}`);\n});\n\n// Note: Binding to ports < 1024 often requires elevated privileges (e.g., sudo/root).\n// For non-root operation, use a port >= 1024.\nserver.bind(514, '0.0.0.0', () => {\n    console.log('Attempting to bind UDP server to port 514');\n});","lang":"javascript","description":"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."},"warnings":[{"fix":"For new projects, consider using actively maintained syslog libraries or implementing custom parsers/producers. For existing projects, thoroughly audit the code, consider vendoring, and implement extensive testing.","message":"The `glossy` package is effectively abandoned, with its last release over 11 years ago. This means it is unlikely to receive updates for security vulnerabilities, bug fixes, or compatibility with modern Node.js versions or JavaScript language features. It also lacks official TypeScript types, though community types exist (`@types/glossy`).","severity":"breaking","affected_versions":"<=0.1.7"},{"fix":"When initializing `glossy.Produce`, specify `{ type: 'BSD' }` in the constructor options if you need to generate RFC 3164 compliant messages. Example: `new Produce({ type: 'BSD', ...otherOptions })`.","message":"When producing syslog messages, `glossy.Produce` defaults to the newer RFC 5424 format unless explicitly configured for BSD/RFC 3164 style. This can lead to compatibility issues with older syslog consumers or relays that are not expecting the RFC 5424 format.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use `const { Name } = require('glossy');` for all imports. If you must use ESM in your project, you'll need to configure your build system to handle CommonJS modules or use dynamic imports (`import('glossy')`).","message":"The library primarily uses CommonJS `require()` syntax. Direct `import` statements (ESM) will not work without a build step (like Webpack or Rollup) or specific Node.js configuration (`\"type\": \"module\"` with CJS interoperability settings).","severity":"gotcha","affected_versions":"<=0.1.7"},{"fix":"Consider running the syslog server on a non-privileged port (e.g., `5514`) and configure your firewall or a dedicated syslog daemon (like `rsyslog` or `syslog-ng`) to forward messages from port 514 to your application's higher port. Alternatively, use operating system capabilities to grant port binding permission without full root access.","message":"Binding to privileged ports (like UDP port 514 for syslog) requires elevated permissions on most operating systems. Running a Node.js application as root introduces security risks.","severity":"gotcha","affected_versions":"N/A"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure your file is treated as a CommonJS module (e.g., `.js` file without `\"type\": \"module\"` in package.json), or use dynamic `import('glossy').then(({ Parse }) => ...)` if you need to use `glossy` within an ESM context.","cause":"Attempting to use `require()` in an ES Module context (e.g., in a file with `\"type\": \"module\"` in package.json or a `.mjs` file).","error":"ReferenceError: require is not defined"},{"fix":"Ensure you are correctly destructuring `Parse` from the `require` statement: `const { Parse } = require('glossy');` then call `Parse.parse(...)`.","cause":"Incorrectly importing or accessing the `Parse` object, possibly trying to call `parse` on the main `glossy` export instead of the `Parse` object.","error":"TypeError: glossy.Parse.parse is not a function"}],"ecosystem":"npm"}