API ========================== - back to [README.md](../README.md) API convention == ## SyslogPro The SyslogPro module for sending syslog messages Most APIs will return a promise. These APIs can be used using `then(...)/catch(...)` Syslog formatting classes can be used as input into a Syslog class to be used simultaneously to the same Syslog server. The Syslog Class with a configured Syslog server target can also be used as the input into each of the formatting classes so that they may run independently. **Version**: 0.1.0 **Author**: Craig Yamato **Copyright**: (c) 2018 - Craig Yamato * [SyslogPro](#module_SyslogPro) * [~Syslog](#module_SyslogPro..Syslog) * [new Syslog([options])](#new_module_SyslogPro..Syslog_new) * [.target](#module_SyslogPro..Syslog+target) : string * [.protocol](#module_SyslogPro..Syslog+protocol) : string * [.port](#module_SyslogPro..Syslog+port) : number * [.tcpTimeout](#module_SyslogPro..Syslog+tcpTimeout) : number * [.tlsServerCerts](#module_SyslogPro..Syslog+tlsServerCerts) : Array.<string> * [.tlsClientCert](#module_SyslogPro..Syslog+tlsClientCert) : string * [.tlsClientKey](#module_SyslogPro..Syslog+tlsClientKey) : string * [.format](#module_SyslogPro..Syslog+format) : string * [.rfc3164](#module_SyslogPro..Syslog+rfc3164) : RFC3164 * [.rfc5424](#module_SyslogPro..Syslog+rfc5424) : RFC5424 * [.leef](#module_SyslogPro..Syslog+leef) : LEEF * [.cef](#module_SyslogPro..Syslog+cef) : CEF * [~RFC3164](#module_SyslogPro..RFC3164) * [new RFC3164([options])](#new_module_SyslogPro..RFC3164_new) * [.color](#module_SyslogPro..RFC3164+color) : boolean * [.extendedColor](#module_SyslogPro..RFC3164+extendedColor) : boolean * [.setColor()](#module_SyslogPro..RFC3164+setColor) * [.buildMessage(msg, [options])](#module_SyslogPro..RFC3164+buildMessage) ⇒ Promise * [.send(msg, [options])](#module_SyslogPro..RFC3164+send) ⇒ Promise * [.emergency(msg)](#module_SyslogPro..RFC3164+emergency) ⇒ Promise * [.emer(msg)](#module_SyslogPro..RFC3164+emer) ⇒ Promise * [.alert(msg)](#module_SyslogPro..RFC3164+alert) ⇒ Promise * [.critical(msg)](#module_SyslogPro..RFC3164+critical) ⇒ Promise * [.crit(msg)](#module_SyslogPro..RFC3164+crit) ⇒ Promise * [.error(msg)](#module_SyslogPro..RFC3164+error) ⇒ Promise * [.err(msg)](#module_SyslogPro..RFC3164+err) ⇒ Promise * [.warning(msg)](#module_SyslogPro..RFC3164+warning) ⇒ Promise * [.warn(msg)](#module_SyslogPro..RFC3164+warn) ⇒ Promise * [.notice(msg)](#module_SyslogPro..RFC3164+notice) ⇒ Promise * [.note(msg)](#module_SyslogPro..RFC3164+note) ⇒ Promise * [.informational(msg)](#module_SyslogPro..RFC3164+informational) ⇒ Promise * [.info(msg)](#module_SyslogPro..RFC3164+info) ⇒ Promise * [.log(msg)](#module_SyslogPro..RFC3164+log) ⇒ Promise * [.debug(msg)](#module_SyslogPro..RFC3164+debug) ⇒ Promise * [~RFC5424](#module_SyslogPro..RFC5424) * [new RFC5424([options])](#new_module_SyslogPro..RFC5424_new) * [.timestamp](#module_SyslogPro..RFC5424+timestamp) : boolean * [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : boolean * [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : boolean * [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : boolean * [.includeStructuredData](#module_SyslogPro..RFC5424+includeStructuredData) : boolean * [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : boolean * [.color](#module_SyslogPro..RFC5424+color) : boolean * [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : boolean * [.setColor()](#module_SyslogPro..RFC5424+setColor) * [.buildMessage(msg, [options])](#module_SyslogPro..RFC5424+buildMessage) ⇒ Promise * [.send(msg)](#module_SyslogPro..RFC5424+send) ⇒ Promise * [.emergency(msg)](#module_SyslogPro..RFC5424+emergency) ⇒ Promise * [.emer(msg)](#module_SyslogPro..RFC5424+emer) ⇒ Promise * [.alert(msg)](#module_SyslogPro..RFC5424+alert) ⇒ Promise * [.critical(msg)](#module_SyslogPro..RFC5424+critical) ⇒ Promise * [.crit(msg)](#module_SyslogPro..RFC5424+crit) ⇒ Promise * [.error(msg)](#module_SyslogPro..RFC5424+error) ⇒ Promise * [.err(msg)](#module_SyslogPro..RFC5424+err) ⇒ Promise * [.warning(msg)](#module_SyslogPro..RFC5424+warning) ⇒ Promise * [.warn(msg)](#module_SyslogPro..RFC5424+warn) ⇒ Promise * [.notice(msg)](#module_SyslogPro..RFC5424+notice) ⇒ Promise * [.note(msg)](#module_SyslogPro..RFC5424+note) ⇒ Promise * [.informational(msg)](#module_SyslogPro..RFC5424+informational) ⇒ Promise * [.info(msg)](#module_SyslogPro..RFC5424+info) ⇒ Promise * [.log(msg)](#module_SyslogPro..RFC5424+log) ⇒ Promise * [.debug(msg)](#module_SyslogPro..RFC5424+debug) ⇒ Promise * [~LEEF](#module_SyslogPro..LEEF) * [new LEEF([options])](#new_module_SyslogPro..LEEF_new) * [.vendor](#module_SyslogPro..LEEF+vendor) : string * [.product](#module_SyslogPro..LEEF+product) : string * [.version](#module_SyslogPro..LEEF+version) : string * [.eventId](#module_SyslogPro..LEEF+eventId) : string * [.syslogHeader](#module_SyslogPro..LEEF+syslogHeader) : boolean * [.attributes](#module_SyslogPro..LEEF+attributes) : object * [.buildMessage()](#module_SyslogPro..LEEF+buildMessage) ⇒ Promise * [.send([options])](#module_SyslogPro..LEEF+send) * [~CEF](#module_SyslogPro..CEF) * [new CEF([options])](#new_module_SyslogPro..CEF_new) * [.deviceVendor](#module_SyslogPro..CEF+deviceVendor) : string * [.deviceProduct](#module_SyslogPro..CEF+deviceProduct) : string * [.deviceVersion](#module_SyslogPro..CEF+deviceVersion) : string * [.deviceEventClassId](#module_SyslogPro..CEF+deviceEventClassId) : string * [.name](#module_SyslogPro..CEF+name) : string * [.severity](#module_SyslogPro..CEF+severity) : string * [.extensions](#module_SyslogPro..CEF+extensions) : object * [.validate()](#module_SyslogPro..CEF+validate) ⇒ Promise * [.buildMessage()](#module_SyslogPro..CEF+buildMessage) ⇒ Promise * [.send([options])](#module_SyslogPro..CEF+send) ### SyslogPro~Syslog A class to work with syslog messages using UDP, TCP, or TLS transport. There is support for Syslog message formatting RFC-3164, RFC-5424 including Structured Data, IBM LEEF (Log Event Extended Format), and HP CEF (Common Event Format). Syslog formatting classes can be used as input into a Syslog class to be used simultaneously to the same Syslog server. * **Kind**: inner class of [SyslogPro](#module_SyslogPro) **Requires**: module:moment **Since**: 0.0.0 **Version**: 0.0.0 * [~Syslog](#module_SyslogPro..Syslog) * [new Syslog([options])](#new_module_SyslogPro..Syslog_new) * [.target](#module_SyslogPro..Syslog+target) : string * [.protocol](#module_SyslogPro..Syslog+protocol) : string * [.port](#module_SyslogPro..Syslog+port) : number * [.tcpTimeout](#module_SyslogPro..Syslog+tcpTimeout) : number * [.tlsServerCerts](#module_SyslogPro..Syslog+tlsServerCerts) : Array.<string> * [.tlsClientCert](#module_SyslogPro..Syslog+tlsClientCert) : string * [.tlsClientKey](#module_SyslogPro..Syslog+tlsClientKey) : string * [.format](#module_SyslogPro..Syslog+format) : string * [.rfc3164](#module_SyslogPro..Syslog+rfc3164) : RFC3164 * [.rfc5424](#module_SyslogPro..Syslog+rfc5424) : RFC5424 * [.leef](#module_SyslogPro..Syslog+leef) : LEEF * [.cef](#module_SyslogPro..Syslog+cef) : CEF #### new Syslog([options]) Construct a new Syslog transport object with user options | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | Options object >>>Transport Configuration | | [options.target] | string | "'localhost'" | The IP Address|FQDN of the Syslog Server, this option if set will take presidents over any target set in a formatting object | | [options.protocol] | string | "'udp'" | L4 transport protocol (udp|tcp|tls), this option if set will take presidents over any transport set in a formatting object | | [options.port] | number | 514 | IP port, this option if set will take presidents over any IP Port set in a formatting object | | [options.tcpTimeout] | number | 10000 | Ignored for all other transports, this option if set will take presidents over any timeout set in a formatting object | | [options.tlsServerCerts] | Array.<string> | | Array of authorized TLS server certificates file locations, this option if set will take presidents over any certificates set in a formatting object | | [options.tlsClientCert] | string | | Client TLS certificate file location that this client should use, this option if set will take presidents over any certificates set in a formatting object | | [options.tlsClientKey] | string | | Client TLS key file location that this client should use, this option if set will take presidents over any certificates set in a formatting object >>>Syslog Format Settings | | [options.format] | string | "'none'" | Valid syslog format options for this module are 'none', 'rfc3164', 'rfc5424', 'leef', 'cef' | | [options.rfc5424] | RFC3164 | | {@link module:SyslogPro~RFC5424| RFC5424 related settings} | | [options.rfc5424] | RFC5424 | | {@link module:SyslogPro~RFC5424| RFC5424 related settings} | | [options.leef] | LEEF | | {@link module:SyslogPro~LEEF|IBM LEEF (Log Event Extended Format) object} | | [options.cef] | CEF | | {@link module:SyslogPro~CEF|HP CEF (Common Event Format) formatting object} | #### syslog.target : string **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.protocol : string **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.port : number **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.tcpTimeout : number **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.tlsServerCerts : Array.<string> **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.tlsClientCert : string **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.tlsClientKey : string **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.format : string **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.rfc3164 : RFC3164 **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.rfc5424 : RFC5424 **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.leef : LEEF **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) #### syslog.cef : CEF **Kind**: instance property of [Syslog](#module_SyslogPro..Syslog) ### SyslogPro~RFC3164 A class to work with RFC3164 formatted syslog messages. The messaging is fully configurable and ANSI foreground colors can be added. Both ANSI 8 and ANSI 256 color are fully supported. Most APIs will return a promise. These APIs can be used using `then(...)/catch(...)` A Syslog class with a configured Syslog server target can also be used as the input into the formatting classes so that it may run independently. The RFC3164 Syslog logging format is meant to be used as a stream of log data from a service or application. This class is designed to be used in this fashion where new messages are written to the class as needed. **Kind**: inner class of [SyslogPro](#module_SyslogPro) **Requires**: module:moment **Since**: 0.0.0 **Version**: 0.0.0 * [~RFC3164](#module_SyslogPro..RFC3164) * [new RFC3164([options])](#new_module_SyslogPro..RFC3164_new) * [.color](#module_SyslogPro..RFC3164+color) : boolean * [.extendedColor](#module_SyslogPro..RFC3164+extendedColor) : boolean * [.setColor()](#module_SyslogPro..RFC3164+setColor) * [.buildMessage(msg, [options])](#module_SyslogPro..RFC3164+buildMessage) ⇒ Promise * [.send(msg, [options])](#module_SyslogPro..RFC3164+send) ⇒ Promise * [.emergency(msg)](#module_SyslogPro..RFC3164+emergency) ⇒ Promise * [.emer(msg)](#module_SyslogPro..RFC3164+emer) ⇒ Promise * [.alert(msg)](#module_SyslogPro..RFC3164+alert) ⇒ Promise * [.critical(msg)](#module_SyslogPro..RFC3164+critical) ⇒ Promise * [.crit(msg)](#module_SyslogPro..RFC3164+crit) ⇒ Promise * [.error(msg)](#module_SyslogPro..RFC3164+error) ⇒ Promise * [.err(msg)](#module_SyslogPro..RFC3164+err) ⇒ Promise * [.warning(msg)](#module_SyslogPro..RFC3164+warning) ⇒ Promise * [.warn(msg)](#module_SyslogPro..RFC3164+warn) ⇒ Promise * [.notice(msg)](#module_SyslogPro..RFC3164+notice) ⇒ Promise * [.note(msg)](#module_SyslogPro..RFC3164+note) ⇒ Promise * [.informational(msg)](#module_SyslogPro..RFC3164+informational) ⇒ Promise * [.info(msg)](#module_SyslogPro..RFC3164+info) ⇒ Promise * [.log(msg)](#module_SyslogPro..RFC3164+log) ⇒ Promise * [.debug(msg)](#module_SyslogPro..RFC3164+debug) ⇒ Promise #### new RFC3164([options]) Construct a new RFC3164 formatted Syslog object with user options | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | Options object | | [options.applicationName] | string | "'NodeJSLogger'" | Application | | [options.hostname] | string | "os.hostname" | The name of this server | | [options.facility] | number | 23 | Facility code to use sending this message | | [options.color] | boolean | false | Apply color coding encoding tag with syslog message text | | [options.extendedColor] | boolean | false | Use the extended ANSI color set encoding tag with syslog message text | | [options.colors] | object | | User defended colors for severities | | [options.colors.emergencyColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.alertColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.criticalColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.errorColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.warningColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.noticeColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.informationalColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.debugColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.server] | Syslog | false | A {@link module:SyslogPro~Syslog| Syslog server connection} that should be used to send messages directly from this class. @see SyslogPro~Syslog | #### rfC3164.color : boolean **Kind**: instance property of [RFC3164](#module_SyslogPro..RFC3164) #### rfC3164.extendedColor : boolean **Kind**: instance property of [RFC3164](#module_SyslogPro..RFC3164) #### rfC3164.setColor() Sets the color to be used for messages at a set priority **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Throws**: - Error A standard error object **Access**: public | Param | Type | Description | | --- | --- | --- | | [colors.emergencyColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.alertColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.criticalColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.errorColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.warningColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.noticeColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.informationalColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.debugColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | #### rfC3164.buildMessage(msg, [options]) ⇒ Promise Building a formatted message. Returns a promise with a formatted message **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - A Syslog formatted string according to the selected RFC **Throws**: - Error A standard error object **Access**: public | Param | Type | Default | Description | | --- | --- | --- | --- | | msg | string | | The Syslog Message | | [options] | object | | Options object | | [options.severity] | number | 7 | An array of structure | | [options.colorCode] | number | 36 | The ANSI color code to use if message coloration is selected | #### rfC3164.send(msg, [options]) ⇒ Promise send a RFC5424 formatted message. Returns a promise with the formatted message that was sent. If no server connection was defined when the class was created a default Syslog connector will be used. **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - A Syslog formatted string according to the selected RFC **Throws**: - Error A standard error object **Access**: public **See**: SyslogPro~Syslog | Param | Type | Default | Description | | --- | --- | --- | --- | | msg | string | | The unformatted Syslog message to send | | [options] | object | | Options object | | [options.severity] | number | 7 | An array of structure | | [options.colorCode] | number | 36 | The ANSI color code to use if | #### rfC3164.emergency(msg) ⇒ Promise Send a syslog message with a security level of 0 (Emergency) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The emergency message to send to the Syslog server | #### rfC3164.emer(msg) ⇒ Promise Send a syslog message with a security level of 0 (Emergency) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The emergency message to send to the Syslog server | #### rfC3164.alert(msg) ⇒ Promise Send a syslog message with a severity level of 1 (Alert) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The alert message to send to the Syslog server | #### rfC3164.critical(msg) ⇒ Promise Send a syslog message with a severity level of 2 (Critical) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The critical message to send to the Syslog server | #### rfC3164.crit(msg) ⇒ Promise Send a syslog message with a severity level of 2 (Critical) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The critical message to send to the Syslog server | #### rfC3164.error(msg) ⇒ Promise Send a syslog message with a severity level of 3 (Error) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The error message to send to the Syslog server | #### rfC3164.err(msg) ⇒ Promise Send a syslog message with a severity level of 3 (Error) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The error message to send to the Syslog server | #### rfC3164.warning(msg) ⇒ Promise Send a syslog message with a severity level of 4 (Warning) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The warning message to send to the Syslog server | #### rfC3164.warn(msg) ⇒ Promise Send a syslog message with a severity level of 4 (Warning) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The warning message to send to the Syslog server | #### rfC3164.notice(msg) ⇒ Promise Send a syslog message with a severity level of 5 (Notice) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The notice message to send to the Syslog server | #### rfC3164.note(msg) ⇒ Promise Send a syslog message with a severity level of 5 (Notice) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The notice message to send to the Syslog server | #### rfC3164.informational(msg) ⇒ Promise Send a syslog message with a severity level of 6 (Informational) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The informational message to send to the Syslog server | #### rfC3164.info(msg) ⇒ Promise Send a syslog message with a severity level of 6 (Informational) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The informational message to send to the Syslog server | #### rfC3164.log(msg) ⇒ Promise Send a syslog message with a severity level of 6 (Informational) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The informational message to send to the Syslog server | #### rfC3164.debug(msg) ⇒ Promise Send a syslog message with a severity level of 7 (Debug) **Kind**: instance method of [RFC3164](#module_SyslogPro..RFC3164) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The debug message to send to the Syslog server | ### SyslogPro~RFC5424 A class to work with RFC5424 formatted syslog messages. The messaging is fully configurable and ANSI foreground * colors can be added. Both ANSI 8 and ANSI 256 color are fully supported. Most APIs will return a promise. These APIs can be used using `then(...)/catch(...)` A Syslog class with a configured Syslog server target can also be used as the input into the formatting classes so that it may run independently. The RFC5424 Syslog logging format is meant to be used as a stream of log data from a service or application. This class is designed to be used in this fashion where new messages are written to the class as needed. **Kind**: inner class of [SyslogPro](#module_SyslogPro) **Requires**: module:moment **Since**: 0.0.0 **Version**: 0.0.0 * [~RFC5424](#module_SyslogPro..RFC5424) * [new RFC5424([options])](#new_module_SyslogPro..RFC5424_new) * [.timestamp](#module_SyslogPro..RFC5424+timestamp) : boolean * [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : boolean * [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : boolean * [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : boolean * [.includeStructuredData](#module_SyslogPro..RFC5424+includeStructuredData) : boolean * [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : boolean * [.color](#module_SyslogPro..RFC5424+color) : boolean * [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : boolean * [.setColor()](#module_SyslogPro..RFC5424+setColor) * [.buildMessage(msg, [options])](#module_SyslogPro..RFC5424+buildMessage) ⇒ Promise * [.send(msg)](#module_SyslogPro..RFC5424+send) ⇒ Promise * [.emergency(msg)](#module_SyslogPro..RFC5424+emergency) ⇒ Promise * [.emer(msg)](#module_SyslogPro..RFC5424+emer) ⇒ Promise * [.alert(msg)](#module_SyslogPro..RFC5424+alert) ⇒ Promise * [.critical(msg)](#module_SyslogPro..RFC5424+critical) ⇒ Promise * [.crit(msg)](#module_SyslogPro..RFC5424+crit) ⇒ Promise * [.error(msg)](#module_SyslogPro..RFC5424+error) ⇒ Promise * [.err(msg)](#module_SyslogPro..RFC5424+err) ⇒ Promise * [.warning(msg)](#module_SyslogPro..RFC5424+warning) ⇒ Promise * [.warn(msg)](#module_SyslogPro..RFC5424+warn) ⇒ Promise * [.notice(msg)](#module_SyslogPro..RFC5424+notice) ⇒ Promise * [.note(msg)](#module_SyslogPro..RFC5424+note) ⇒ Promise * [.informational(msg)](#module_SyslogPro..RFC5424+informational) ⇒ Promise * [.info(msg)](#module_SyslogPro..RFC5424+info) ⇒ Promise * [.log(msg)](#module_SyslogPro..RFC5424+log) ⇒ Promise * [.debug(msg)](#module_SyslogPro..RFC5424+debug) ⇒ Promise #### new RFC5424([options]) Construct a new RFC5424 formatted Syslog object with user options | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | Options object | | [options.applicationName] | string | "'NodeJSLogger'" | Application | | [options.hostname] | string | "os.hostname" | The name of this server | | [options.timestamp] | boolean | false | Included a Timestamp | | [options.timestampUTC] | boolean | false | RFC standard is for local time | | [options.timestampMS] | boolean | false | Timestamp with ms resolution | | [options.timestampTZ] | boolean | true | Should the timestamp included time zone | | [options.includeStructuredData] | boolean | false | Included any provided structured data | | [options.utf8BOM] | boolean | true | Included the UTF8 | | [options.color] | boolean | false | Included the UTF8 | | [options.extendedColor] | boolean | false | Included the UTF8 encoding tag with syslog message text | | [options.colors] | object | | User defended colors for severities | | [options.colors.emergencyColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.alertColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.criticalColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.errorColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.warningColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.noticeColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.informationalColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.colors.debugColor] | string | | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [options.server] | Syslog | false | A {@link module:SyslogPro~Syslog| Syslog server connection} that should be used to send messages directly from this class. @see SyslogPro~Syslog | #### rfC5424.timestamp : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.timestampUTC : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.timestampTZ : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.timestampMS : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.includeStructuredData : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.utf8BOM : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.color : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.extendedColor : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) #### rfC5424.setColor() Sets the color to be used for messages at a set priority **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Throws**: - Error A standard error object **Access**: public | Param | Type | Description | | --- | --- | --- | | [colors.emergencyColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.alertColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.criticalColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.errorColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.warningColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.noticeColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.informationalColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | | [colors.debugColor] | string | A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended) | #### rfC5424.buildMessage(msg, [options]) ⇒ Promise Building a formatted message. Returns a promise with a formatted message **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - A Syslog formatted string according to the selected RFC **Throws**: - Error A standard error object **Access**: public | Param | Type | Default | Description | | --- | --- | --- | --- | | msg | string | | The Syslog Message | | [options] | object | | Options object | | [options.severity] | number | 7 | An array of structure | | [options.facility] | number | 23 | Facility code to use sending this message | | [options.pid] | string | "'-'" | The process id of the service sending this message | | [options.structuredData] | Array.<string> | | An array of structure data strings conforming to the IETF/IANA defined SD-IDs or IANA registered SMI Network Management Private Enterprise Code SD-ID conforming to the format [name@ parameter=value] | | [options.colorCode] | number | 36 | The ANSI color code to use if message coloration is selected | #### rfC5424.send(msg) ⇒ Promise send a RFC5424 formatted message. Returns a promise with the formatted message that was sent. If no server connection was defined when the class was created a default Syslog connector will be used. **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - A Syslog formatted string according to the selected RFC **Throws**: - Error A standard error object **Access**: public **See**: SyslogPro~Syslog | Param | Type | Description | | --- | --- | --- | | msg | string | The unformatted Syslog message to send | #### rfC5424.emergency(msg) ⇒ Promise Send a syslog message with a severity level of 0 (Emergency) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The emergency message to send to the Syslog server | #### rfC5424.emer(msg) ⇒ Promise Send a syslog message with a severity level of 0 (Emergency) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The emergency message to send to the Syslog server | #### rfC5424.alert(msg) ⇒ Promise Send a syslog message with a severity level of 1 (Alert) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The alert message to send to the Syslog server | #### rfC5424.critical(msg) ⇒ Promise Send a syslog message with a severity level of 2 (Critical) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The critical message to send to the Syslog server | #### rfC5424.crit(msg) ⇒ Promise Send a syslog message with a severity level of 2 (Critical) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The critical message to send to the Syslog server | #### rfC5424.error(msg) ⇒ Promise Send a syslog message with a severity level of 3 (Error) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The error message to send to the Syslog server | #### rfC5424.err(msg) ⇒ Promise Send a syslog message with a severity level of 3 (Error) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The error message to send to the Syslog server | #### rfC5424.warning(msg) ⇒ Promise Send a syslog message with a severity level of 4 (Warning) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The warning message to send to the Syslog server | #### rfC5424.warn(msg) ⇒ Promise Send a syslog message with a severity level of 4 (Warning) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The warning message to send to the Syslog server | #### rfC5424.notice(msg) ⇒ Promise Send a syslog message with a severity level of 5 (Notice) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The notice message to send to the Syslog server | #### rfC5424.note(msg) ⇒ Promise Send a syslog message with a severity level of 5 (Notice) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The notice message to send to the Syslog server | #### rfC5424.informational(msg) ⇒ Promise Send a syslog message with a severity level of 6 (Informational) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The informational message to send to the Syslog server | #### rfC5424.info(msg) ⇒ Promise Send a syslog message with a severity level of 6 (Informational) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The informational message to send to the Syslog server | #### rfC5424.log(msg) ⇒ Promise Send a syslog message with a severity level of 6 (Informational) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The informational message to send to the Syslog server | #### rfC5424.debug(msg) ⇒ Promise Send a syslog message with a severity level of 7 (Debug) **Kind**: instance method of [RFC5424](#module_SyslogPro..RFC5424) **Returns**: Promise - - The formatted syslog message sent to the Syslog server **Throws**: - Error - Any bubbled-up error **Access**: public | Param | Type | Description | | --- | --- | --- | | msg | string | The debug message to send to the Syslog server | ### SyslogPro~LEEF A class to work with IBM LEEF (Log Event Extended Format) messages this form of system messages are designed to work with security systems. Messages can be saved to file (Saving to file if not part of this module but a LEEF formatted message produced by this module can be saved externally to it) or sent via Syslog. Most APIs will return a promise. These APIs can be used using `then(...)/catch(...)` A Syslog class with a configured Syslog server target can also be used as the input into the formatting classes so that it may run independently. The LEEF format is designed to send event data to a SIEM system and should not be as a logging stream. This class is meant to be used once per message. **Kind**: inner class of [SyslogPro](#module_SyslogPro) **Requires**: module:moment **Since**: 0.0.0 **Version**: 0.0.0 * [~LEEF](#module_SyslogPro..LEEF) * [new LEEF([options])](#new_module_SyslogPro..LEEF_new) * [.vendor](#module_SyslogPro..LEEF+vendor) : string * [.product](#module_SyslogPro..LEEF+product) : string * [.version](#module_SyslogPro..LEEF+version) : string * [.eventId](#module_SyslogPro..LEEF+eventId) : string * [.syslogHeader](#module_SyslogPro..LEEF+syslogHeader) : boolean * [.attributes](#module_SyslogPro..LEEF+attributes) : object * [.buildMessage()](#module_SyslogPro..LEEF+buildMessage) ⇒ Promise * [.send([options])](#module_SyslogPro..LEEF+send) #### new LEEF([options]) Construct a new LEEF formatting object with user options | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | Options object | | [options.vendor] | string | "'unknown'" | The vendor of the system that generated the event being reported | | [options.product] | string | "'unknown'" | The product name of the system that genrated the event being reported | | [options.version] | string | "'unknown'" | The version name of the system that genrated the event being reported | | [options.eventId] | string | "'unknown'" | The eventId of the system that genrated the event being reported | | [options.attributes] | object | | LEEF message attributes which defaults to all base attributes with null values, new attributes should be added as new elements to this object | | [options.syslogHeader] | boolean | 'true' | Should the LEEF message include a Syslog header with Timestamp and source | | [options.server] | Syslog | false | A {@link module:SyslogPro~Syslog| Syslog server connection} that should be used to send messages directly from this class. @see SyslogPro~Syslog | #### leeF.vendor : string **Kind**: instance property of [LEEF](#module_SyslogPro..LEEF) #### leeF.product : string **Kind**: instance property of [LEEF](#module_SyslogPro..LEEF) #### leeF.version : string **Kind**: instance property of [LEEF](#module_SyslogPro..LEEF) #### leeF.eventId : string **Kind**: instance property of [LEEF](#module_SyslogPro..LEEF) #### leeF.syslogHeader : boolean **Kind**: instance property of [LEEF](#module_SyslogPro..LEEF) #### leeF.attributes : object **Kind**: instance property of [LEEF](#module_SyslogPro..LEEF) #### leeF.buildMessage() ⇒ Promise Build a formatted message **Kind**: instance method of [LEEF](#module_SyslogPro..LEEF) **Returns**: Promise - - string with formatted message **Access**: public #### leeF.send([options]) **Kind**: instance method of [LEEF](#module_SyslogPro..LEEF) **Access**: public | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Syslog | false | A {@link module:SyslogPro~Syslog| Syslog server connection} that should be used to send messages directly from this class. @see SyslogPro~Syslog | ### SyslogPro~CEF A class to work with HP CEF (Common Event Format) messages. This form of system messages are designed to work with security systems. Messages can be saved to file (Saving to file if not part of this module but a CEF formatted message produced by this module can be saved externally to it) or sent via Syslog. Most APIs will return a promise. These APIs can be used using `then(...)/catch(...)` A Syslog class with a configured Syslog server target can also be used as the input into the formatting classes so that it may run independently. The CEF format is designed to send event data to a SIEM system and should not be as a logging stream. This class is meant to be used once per message. **Kind**: inner class of [SyslogPro](#module_SyslogPro) **Requires**: module:moment **Since**: 0.0.0 **Version**: 0.0.0 * [~CEF](#module_SyslogPro..CEF) * [new CEF([options])](#new_module_SyslogPro..CEF_new) * [.deviceVendor](#module_SyslogPro..CEF+deviceVendor) : string * [.deviceProduct](#module_SyslogPro..CEF+deviceProduct) : string * [.deviceVersion](#module_SyslogPro..CEF+deviceVersion) : string * [.deviceEventClassId](#module_SyslogPro..CEF+deviceEventClassId) : string * [.name](#module_SyslogPro..CEF+name) : string * [.severity](#module_SyslogPro..CEF+severity) : string * [.extensions](#module_SyslogPro..CEF+extensions) : object * [.validate()](#module_SyslogPro..CEF+validate) ⇒ Promise * [.buildMessage()](#module_SyslogPro..CEF+buildMessage) ⇒ Promise * [.send([options])](#module_SyslogPro..CEF+send) #### new CEF([options]) Construct a new CEF formatting object with user options | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | Options object | | [options.deviceVendor] | string | "'unknown'" | The vendor of the system that generated the event being reported | | [options.deviceProduct] | string | "'unknown'" | The product name of the system that genrated the event being reported | | [options.deviceVersion] | string | "'unknown'" | The version name of the system that genrated the event being reported | | [options.deviceEventClassId] | string | "'unknown'" | The eventId of the system that genrated the event being reported | | [options.name] | string | "'unknown'" | Name of the service generating the notice | | [options.severity] | string | "'unknown'" | Severity of the notification | | [options.extensions] | string | "{}" | Any CEF Key=Value extensions | | [options.server] | Syslog | false | A {@link module:SyslogPro~Syslog| Syslog server connection} that should be used to send messages directly from this class. @see SyslogPro~Syslog | #### ceF.deviceVendor : string **Kind**: instance property of [CEF](#module_SyslogPro..CEF) #### ceF.deviceProduct : string **Kind**: instance property of [CEF](#module_SyslogPro..CEF) #### ceF.deviceVersion : string **Kind**: instance property of [CEF](#module_SyslogPro..CEF) #### ceF.deviceEventClassId : string **Kind**: instance property of [CEF](#module_SyslogPro..CEF) #### ceF.name : string **Kind**: instance property of [CEF](#module_SyslogPro..CEF) #### ceF.severity : string **Kind**: instance property of [CEF](#module_SyslogPro..CEF) #### ceF.extensions : object **Kind**: instance property of [CEF](#module_SyslogPro..CEF) #### ceF.validate() ⇒ Promise Validate this CEF object **Kind**: instance method of [CEF](#module_SyslogPro..CEF) **Returns**: Promise - - True if validated **Throws**: - Error - First element to fail validation **Access**: public #### ceF.buildMessage() ⇒ Promise Build a CEF formated string **Kind**: instance method of [CEF](#module_SyslogPro..CEF) **Returns**: Promise - - String with formated message **Access**: public #### ceF.send([options]) **Kind**: instance method of [CEF](#module_SyslogPro..CEF) **Access**: public | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Syslog | false | A {@link module:SyslogPro~Syslog| Syslog server connection} that should be used to send messages directly from this class. @see SyslogPro~Syslog | *docs autogenerated via [jsdoc2md] (https://github.com/jsdoc2md/jsdoc-to-markdown)* ## Test ```shell npm test ``` ## Contributing Please try to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.