60 KiB
API
- back to 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 formating classes can be used as input into a Syslog class to be used simultatniusly 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 formating classes so that they may run independtly.
Version: 0.1.0
Author: Craig Yamato craig@kentik.com
Copyright: (c) 2018 - Craig Yamato
- SyslogPro
- ~Syslog
- new Syslog([options])
- .target :
string
- .protocol :
string
- .port :
number
- .tcpTimeout :
number
- .tlsServerCerts :
Array.<string>
- .tlsClientCert :
string
- .tlsClientKey :
string
- .format :
string
- .rfc3164 :
RFC3164
- .rfc5424 :
RFC5424
- .leef :
LEEF
- .cef :
CEF
- ~RFC3164
- new RFC3164([options])
- .color :
boolean
- .extendedColor :
boolean
- .setColor()
- .buildMessage(msg, [options]) ⇒
Promise
- .send(msg, [options]) ⇒
Promise
- .emergency(msg) ⇒
Promise
- .emer(msg) ⇒
Promise
- .alert(msg) ⇒
Promise
- .critical(msg) ⇒
Promise
- .crit(msg) ⇒
Promise
- .error(msg) ⇒
Promise
- .err(msg) ⇒
Promise
- .warning(msg) ⇒
Promise
- .warn(msg) ⇒
Promise
- .notice(msg) ⇒
Promise
- .note(msg) ⇒
Promise
- .informational(msg) ⇒
Promise
- .info(msg) ⇒
Promise
- .log(msg) ⇒
Promise
- .debug(msg) ⇒
Promise
- ~RFC5424
- new RFC5424([options])
- .timestamp :
boolean
- .timestampUTC :
boolean
- .timestampTZ :
boolean
- .timestampMS :
boolean
- .encludeStructuredData :
boolean
- .utf8BOM :
boolean
- .color :
boolean
- .extendedColor :
boolean
- .setColor()
- .buildMessage(msg, [options]) ⇒
Promise
- .send(msg) ⇒
Promise
- .emergency(msg) ⇒
Promise
- .emer(msg) ⇒
Promise
- .alert(msg) ⇒
Promise
- .critical(msg) ⇒
Promise
- .crit(msg) ⇒
Promise
- .error(msg) ⇒
Promise
- .err(msg) ⇒
Promise
- .warning(msg) ⇒
Promise
- .warn(msg) ⇒
Promise
- .notice(msg) ⇒
Promise
- .note(msg) ⇒
Promise
- .informational(msg) ⇒
Promise
- .info(msg) ⇒
Promise
- .log(msg) ⇒
Promise
- .debug(msg) ⇒
Promise
- ~LEEF
- new LEEF([options])
- .vendor :
string
- .product :
string
- .version :
string
- .eventId :
string
- .syslogHeader :
boolean
- .attrabutes :
object
- .buildMessage() ⇒
Promise
- .send([options])
- ~CEF
- new CEF([options])
- .deviceVendor :
string
- .deviceProduct :
string
- .deviceVersion :
string
- .deviceEventClassId :
string
- .name :
string
- .severity :
string
- .extensions :
object
- .validate() ⇒
Promise
- .buildMessage() ⇒
Promise
- .send([options])
- ~Syslog
SyslogPro~Syslog
A class to work with syslog messages using UDP, TCP, or TLS transport.
There is suport for Syslog message formating RFC-3164, RFC-5424 including
Structured Data, IBM LEEF (Log Event Extended Format), and HP CEF (Common
Event Format).
Syslog formating classes can be used as input into a Syslog class to be used
simultatniusly to the same Syslog server. *
Kind: inner class of SyslogPro
Requires: module:moment
Since: 0.0.0
Version: 0.0.0
- ~Syslog
- new Syslog([options])
- .target :
string
- .protocol :
string
- .port :
number
- .tcpTimeout :
number
- .tlsServerCerts :
Array.<string>
- .tlsClientCert :
string
- .tlsClientKey :
string
- .format :
string
- .rfc3164 :
RFC3164
- .rfc5424 :
RFC5424
- .leef :
LEEF
- .cef :
CEF
new Syslog([options])
Construct a new Syslog transport object with user options
Param | Type | Default | Description |
---|---|---|---|
[options] | object |
Options object >>>Transport Configuraton | |
[options.target] | string |
"'localhost'" |
The IP Address |
[options.protocol] | string |
"'udp'" |
L4 transport portocol (udp |
[options.port] | number |
514 |
IP port, this option if set will take prasdents over any IP Port set in a formating object |
[options.tcpTimeout] | number |
10000 |
Ignored for all other transports, this option if set will take prasdents over any timeout set in a formating object |
[options.tlsServerCerts] | Array.<string> |
Array of authrized TLS server certificates file locations, this option if set will take prasdents over any certificates set in a formating object | |
[options.tlsClientCert] | string |
Client TLS certificate file location that this client should use, this option if set will take prasdents over any certificates set in a formating object | |
[options.tlsClientKey] | string |
Client TLS key file location that this client should use, this option if set will take prasdents over any certificates set in a formating 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 | |
[options.rfc5424] | RFC5424 |
{@link module:SyslogPro~RFC5424 | |
[options.leef] | LEEF |
{@link module:SyslogPro~LEEF | |
[options.cef] | CEF |
{@link module:SyslogPro~CEF |
syslog.target : string
Kind: instance property of Syslog
syslog.protocol : string
Kind: instance property of Syslog
syslog.port : number
Kind: instance property of Syslog
syslog.tcpTimeout : number
Kind: instance property of Syslog
syslog.tlsServerCerts : Array.<string>
Kind: instance property of Syslog
syslog.tlsClientCert : string
Kind: instance property of Syslog
syslog.tlsClientKey : string
Kind: instance property of Syslog
syslog.format : string
Kind: instance property of Syslog
syslog.rfc3164 : RFC3164
Kind: instance property of Syslog
syslog.rfc5424 : RFC5424
Kind: instance property of Syslog
syslog.leef : LEEF
Kind: instance property of Syslog
syslog.cef : CEF
Kind: instance property of Syslog
SyslogPro~RFC3164
A class to work with RFC3164 formated syslog messages. The meesaging is fully configurabule and Ansi foreground
colors can be added. Both ANSI 8 and ANSI 256 color are fully suported.
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 formating classes so that it may run independtly.
The RFC3164 Syslog logging format is ment to be used as a stream of log data from a service or applacation. This class is designed to be used in this fashion where new messages are writen to the class as needed.
Kind: inner class of SyslogPro
Requires: module:moment
Since: 0.0.0
Version: 0.0.0
- ~RFC3164
- new RFC3164([options])
- .color :
boolean
- .extendedColor :
boolean
- .setColor()
- .buildMessage(msg, [options]) ⇒
Promise
- .send(msg, [options]) ⇒
Promise
- .emergency(msg) ⇒
Promise
- .emer(msg) ⇒
Promise
- .alert(msg) ⇒
Promise
- .critical(msg) ⇒
Promise
- .crit(msg) ⇒
Promise
- .error(msg) ⇒
Promise
- .err(msg) ⇒
Promise
- .warning(msg) ⇒
Promise
- .warn(msg) ⇒
Promise
- .notice(msg) ⇒
Promise
- .note(msg) ⇒
Promise
- .informational(msg) ⇒
Promise
- .info(msg) ⇒
Promise
- .log(msg) ⇒
Promise
- .debug(msg) ⇒
Promise
new RFC3164([options])
Construct a new RFC3164 formated Syslog object with user options
Param | Type | Default | Description |
---|---|---|---|
[options] | object |
Options object | |
[options.applacationName] | string |
"'NodeJSLogger'" |
Applacation |
[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 extedned ANSI color set encoding tag with syslog message text |
[options.colors] | object |
User defended colors for severites | |
[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 |
rfC3164.color : boolean
Kind: instance property of RFC3164
rfC3164.extendedColor : boolean
Kind: instance property of RFC3164
rfC3164.setColor()
Sets the color to be used for messages at a set priority
Kind: instance method of 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 formated message. Returns a promise with a formated message
Kind: instance method of RFC3164
Returns: Promise
- A Syslog formated string acording 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 formated message. Returns a promise with the formated message that was sent. If no server connection was defined when the class was created a defualt Syslog connector will be used.
Kind: instance method of RFC3164
Returns: Promise
- A Syslog formated string acording to the selected RFC
Throws:
Error
A standard error object
Access: public
See: SyslogPro~Syslog
Param | Type | Default | Description |
---|---|---|---|
msg | string |
The unformated 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 secerity level of 0 (Emergency)
Kind: instance method of RFC3164
Returns: Promise
- - The formated syslog message sent to the Syslog server
Throws:
Error
- Any bubbled up error
Access: public
Param | Type | Description |
---|---|---|
msg | string |
The emergancy message to send to the Syslog server |
rfC3164.emer(msg) ⇒ Promise
Send a syslog message with a secerity level of 0 (Emergency)
Kind: instance method of RFC3164
Returns: Promise
- - The formated syslog message sent to the Syslog server
Throws:
Error
- Any bubbled up error
Access: public
Param | Type | Description |
---|---|---|
msg | string |
The emergancy message to send to the Syslog server |
rfC3164.alert(msg) ⇒ Promise
Send a syslog message with a secerity level of 1 (Alert)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 2 (Critical)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 2 (Critical)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 3 (Error)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 3 (Error)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 4 (Warning)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 4 (Warning)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 5 (Notice)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 5 (Notice)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 6 (Informational)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 6 (Informational)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 6 (Informational)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 secerity level of 7 (Debug)
Kind: instance method of RFC3164
Returns: Promise
- - The formated 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 formated syslog messages. The meesaging is fully configurabule and Ansi foreground
colors can be added. Both ANSI 8 and ANSI 256 color are fully suported.
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 formating classes so that it may run independtly.
The RFC5424 Syslog logging format is ment to be used as a stream of log data from a service or applacation. This class is designed to be used in this fashion where new messages are writen to the class as needed.
Kind: inner class of SyslogPro
Requires: module:moment
Since: 0.0.0
Version: 0.0.0
- ~RFC5424
- new RFC5424([options])
- .timestamp :
boolean
- .timestampUTC :
boolean
- .timestampTZ :
boolean
- .timestampMS :
boolean
- .encludeStructuredData :
boolean
- .utf8BOM :
boolean
- .color :
boolean
- .extendedColor :
boolean
- .setColor()
- .buildMessage(msg, [options]) ⇒
Promise
- .send(msg) ⇒
Promise
- .emergency(msg) ⇒
Promise
- .emer(msg) ⇒
Promise
- .alert(msg) ⇒
Promise
- .critical(msg) ⇒
Promise
- .crit(msg) ⇒
Promise
- .error(msg) ⇒
Promise
- .err(msg) ⇒
Promise
- .warning(msg) ⇒
Promise
- .warn(msg) ⇒
Promise
- .notice(msg) ⇒
Promise
- .note(msg) ⇒
Promise
- .informational(msg) ⇒
Promise
- .info(msg) ⇒
Promise
- .log(msg) ⇒
Promise
- .debug(msg) ⇒
Promise
new RFC5424([options])
Construct a new RFC5424 formated Syslog object with user options
Param | Type | Default | Description |
---|---|---|---|
[options] | object |
Options object | |
[options.applacationName] | string |
"'NodeJSLogger'" |
Applacation |
[options.hostname] | string |
"os.hostname" |
The name of this server |
[options.timestamp] | boolean |
false |
Included a Timestamp |
[options.timestampUTC] | boolean |
false |
RFC tandard is for local time |
[options.timestampMS] | boolean |
false |
Timestamp with ms resoltuion |
[options.timestampTZ] | boolean |
true |
Should the timestamp included timezone |
[options.encludeStructuredData] | 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 severites | |
[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 |
rfC5424.timestamp : boolean
Kind: instance property of RFC5424
rfC5424.timestampUTC : boolean
Kind: instance property of RFC5424
rfC5424.timestampTZ : boolean
Kind: instance property of RFC5424
rfC5424.timestampMS : boolean
Kind: instance property of RFC5424
rfC5424.encludeStructuredData : boolean
Kind: instance property of RFC5424
rfC5424.utf8BOM : boolean
Kind: instance property of RFC5424
rfC5424.color : boolean
Kind: instance property of RFC5424
rfC5424.extendedColor : boolean
Kind: instance property of RFC5424
rfC5424.setColor()
Sets the color to be used for messages at a set priority
Kind: instance method of 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 formated message. Returns a promise with a formated message
Kind: instance method of RFC5424
Returns: Promise
- A Syslog formated string acording 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 registred 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 formated message. Returns a promise with the formated message that was sent. If no server connection was defined when the class was created a defualt Syslog connector will be used.
Kind: instance method of RFC5424
Returns: Promise
- A Syslog formated string acording to the selected RFC
Throws:
Error
A standard error object
Access: public
See: SyslogPro~Syslog
Param | Type | Description |
---|---|---|
msg | string |
The unformated Syslog message to send |
rfC5424.emergency(msg) ⇒ Promise
Send a syslog message with a secerity level of 0 (Emergency)
Kind: instance method of RFC5424
Returns: Promise
- - The formated syslog message sent to the Syslog server
Throws:
Error
- Any bubbled up error
Access: public
Param | Type | Description |
---|---|---|
msg | string |
The emergancy message to send to the Syslog server |
rfC5424.emer(msg) ⇒ Promise
Send a syslog message with a secerity level of 0 (Emergency)
Kind: instance method of RFC5424
Returns: Promise
- - The formated syslog message sent to the Syslog server
Throws:
Error
- Any bubbled up error
Access: public
Param | Type | Description |
---|---|---|
msg | string |
The emergancy message to send to the Syslog server |
rfC5424.alert(msg) ⇒ Promise
Send a syslog message with a secerity level of 1 (Alert)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 2 (Critical)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 2 (Critical)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 3 (Error)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 3 (Error)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 4 (Warning)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 4 (Warning)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 5 (Notice)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 5 (Notice)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 6 (Informational)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 6 (Informational)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 6 (Informational)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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 secerity level of 7 (Debug)
Kind: instance method of RFC5424
Returns: Promise
- - The formated 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
formated mesage produced by this module can be saved externaly 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 formating classes so that it may run independtly. The LEEF format is designed to send event data to a SIEM system and should not be as a logging stream. This class is ment to be used once per message.
Kind: inner class of SyslogPro
Requires: module:moment
Since: 0.0.0
Version: 0.0.0
- ~LEEF
- new LEEF([options])
- .vendor :
string
- .product :
string
- .version :
string
- .eventId :
string
- .syslogHeader :
boolean
- .attrabutes :
object
- .buildMessage() ⇒
Promise
- .send([options])
new LEEF([options])
Construct a new LEEF formating object with user options
Param | Type | Default | Description |
---|---|---|---|
[options] | object |
Options object | |
[options.vendor] | string |
"'unknown'" |
The vendor of the system that genrated 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.attrabute] | object |
LEEF message attrabutes which defualts to all base attrabutes with null values, new attrabutes 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 |
leeF.vendor : string
Kind: instance property of LEEF
leeF.product : string
Kind: instance property of LEEF
leeF.version : string
Kind: instance property of LEEF
leeF.eventId : string
Kind: instance property of LEEF
leeF.syslogHeader : boolean
Kind: instance property of LEEF
leeF.attrabutes : object
Kind: instance property of LEEF
leeF.buildMessage() ⇒ Promise
Build a formated message
Kind: instance method of LEEF
Returns: Promise
- - string with formated message
Access: public
leeF.send([options])
Kind: instance method of LEEF
Access: public
Param | Type | Default | Description |
---|---|---|---|
[options] | Syslog |
false |
A {@link module: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
formated mesage produced by this module can be saved externaly 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 formating classes so that it may run independtly. The CEF format is designed to send event data to a SIEM system and should not be as a logging stream. This class is ment to be used once per message.
Kind: inner class of SyslogPro
Requires: module:moment
Since: 0.0.0
Version: 0.0.0
- ~CEF
- new CEF([options])
- .deviceVendor :
string
- .deviceProduct :
string
- .deviceVersion :
string
- .deviceEventClassId :
string
- .name :
string
- .severity :
string
- .extensions :
object
- .validate() ⇒
Promise
- .buildMessage() ⇒
Promise
- .send([options])
new CEF([options])
Construct a new CEF formating object with user options
Param | Type | Default | Description |
---|---|---|---|
[options] | object |
Options object | |
[options.deviceVendor] | string |
"'unknown'" |
The vendor of the system that genrated 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 genrating the notice |
[options.severity] | string |
"'unknown'" |
Severity of the notification |
[options.extensions] | string |
"{}" |
Any CEF Key=Value extentions |
[options.server] | Syslog |
false |
A {@link module:SyslogPro~Syslog |
ceF.deviceVendor : string
Kind: instance property of CEF
ceF.deviceProduct : string
Kind: instance property of CEF
ceF.deviceVersion : string
Kind: instance property of CEF
ceF.deviceEventClassId : string
Kind: instance property of CEF
ceF.name : string
Kind: instance property of CEF
ceF.severity : string
Kind: instance property of CEF
ceF.extensions : object
Kind: instance property of CEF
ceF.validate() ⇒ Promise
Validate this CEF object
Kind: instance method of CEF
Returns: Promise
- - True if valadated
Throws:
Error
- First element to fail valadation
ceF.buildMessage() ⇒ Promise
Build a CEF formated string
Kind: instance method of CEF
Returns: Promise
- - String with formated message
Access: public
ceF.send([options])
Kind: instance method of CEF
Access: public
Param | Type | Default | Description |
---|---|---|---|
[options] | Syslog |
false |
A {@link module:SyslogPro~Syslog |
docs autogenerated via [jsdoc2md] (https://github.com/jsdoc2md/jsdoc-to-markdown)
Test
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.