syslog-server is a lightweight Node.js library for creating a server to receive syslog messages over UDP. It provides a simple, event-driven API to start, stop, and manage the syslog listener. The library, currently at version 1.0.1, allows configuration of the listening port and address, and emits 'message' events for each incoming syslog packet. Each message event provides parsed details such as the reception date, originating host IP, IP protocol version (IPv4/IPv6), and the raw syslog message content. While it does not specify adherence to particular syslog RFCs for deep message parsing, it offers a foundational layer for applications needing to collect basic syslog data. Its primary differentiator is its minimal footprint and direct use of Node.js's built-in `dgram` module, making it suitable for simple syslog collection setups.
npm install syslog-serverVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes a syslog server, logs incoming messages to the console, and includes basic error handling and graceful shutdown.
Run your Node.js application with `sudo` (not recommended for production) or configure your system to allow the Node.js process to bind to privileged ports without root, or choose a non-privileged port (e.g., >1024) for the syslog server.
Use the CommonJS `require()` syntax: `const SyslogServer = require('syslog-server');`. If you must use ESM, consider a transpilation step or a wrapper module that explicitly exports it for ESM consumption.If advanced syslog message parsing (e.g., extracting facility, severity, timestamp from the message string) is required, integrate a dedicated syslog message parsing library or implement custom regex-based parsing on `value.message`.
Run your Node.js application with administrative privileges (e.g., `sudo node app.js`) or configure a non-privileged port (e.g., `server.start({ port: 10514 })`).Change the import statement to `const SyslogServer = require('syslog-server');`.Ensure no other syslog server or application is running on the same port. Use `netstat -tulnp | grep 514` (Linux) or `lsof -i :514` (macOS) to identify the conflicting process, then terminate it or choose a different port for your `syslog-server` instance.
No dependency data recorded yet.