{"library":"nsyslog-parser","title":"nsyslog-parser","description":"The `nsyslog-parser` library provides a robust and flexible solution for parsing syslog messages in Node.js. It supports widely used syslog formats including RFC 3164 (BSD), RFC 5424 (IETF), and the Common Event Format (CEF) popularized by ArcSight. A key differentiator is its fault-tolerant parsing mechanism, designed to extract as much information as possible from non-standard, erroneous, or malformed messages without throwing errors, making it suitable for environments with diverse and potentially imperfect log sources. As of version 0.10.1, the package is primarily a CommonJS module, offering a single default export as a parser function. While specific release cadence is not explicitly stated, its sub-1.0 version suggests a mature but stable utility for its core parsing functionality.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install nsyslog-parser"],"cli":null},"imports":["import parser from 'nsyslog-parser';","const parser = require('nsyslog-parser');","import * as parserModule from 'nsyslog-parser';\nconst parser = parserModule.default || parserModule;"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const parser = require('nsyslog-parser');\n\n// Standard BSD message\nconst bsdLine = \"<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8\";\n\n// IETF (RFC 5424) message, with structured data and chained hostnames\nconst ietfLine = \"<110>1 2009-05-03T14:00:39.529966+02:00 host.example.org/relay.example.org syslogd 2138 - [exampleSDID@32473 iut='3' eventSource='Application' eventID='1011'][exampleSDID@32474 iut='4' eventSource='Application' eventID='1012'][ssign VER='0111' RSID='1' SG='0' SPRI='0' GBC='2' FMN='1' CNT='7' HB='K6wzcombEvKJ+UTMcn9bPryAeaU= zrkDcIeaDluypaPCY8WWzwHpPok= zgrWOdpx16ADc7UmckyIFY53icE= XfopJ+S8/hODapiBBCgVQaLqBKg= J67gKMFl/OauTC20ibbydwIlJC8= M5GziVgB6KPY3ERU1HXdSi2vtdw= Wxd/lU7uG/ipEYT9xeqnsfohyH0=' SIGN='AKBbX4J7QkrwuwdbV7Taujk2lvOf8gCgC62We1QYfnrNHz7FzAvdySuMyfM='] BOMAn application event log entry\";\n\n// Syslog CEF (Common Event Format)\nconst cefLine = \"Jan 18 11:07:53 dsmhost CEF:0|Trend Micro|Deep Security Manager|<DSM version>|600|User Signed In|3|src=10.52.116.160 suser=admin target=admin msg=User signed in from 2001:db8::5\";\n\nconsole.log('BSD Message:', parser(bsdLine));\nconsole.log('IETF Message:', parser(ietfLine));\nconsole.log('CEF Message:', parser(cefLine));","lang":"javascript","description":"This quickstart demonstrates how to import and use the `nsyslog-parser` function to parse various syslog message formats, including BSD, IETF RFC 5424, and CEF. It shows how the parser handles different log line structures and the resulting structured output.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}