Framework: packages: logger - x684867/nemesis_server GitHub Wiki
This package provides centralized logging for the application/framework
through console and SYSLOG by overloading the screen.log() method to
tee writes to screen.log() both to the screen and to the logger's alternate
output streams (e.g. log file).
screen
error
types
fs
net
Filename | Description |
---|---|
config.json | Configuration file (reserved for future use) |
errors-[LOCALIZED LANGUAGE].json | Localized error strings file |
messages-[LOCALIZED LANGUAGE].json | Localized general messages file |
main.js | Main package executable, containing activeJSON code |
loggerClass.js | Syslog primary management class used for setting/getting properties and presenting the log() method |
syslogClient.js | Syslog Client used by loggerClass |
It would make no sense for an organization to implement a key management solution aimed at securing their environment only to allow unencrypted or unreliable SYSLOG traffic to potentially compromise the system. For this reason, the Nemesis project supports SYSLOG only with TLS encryption between the client and server. TLS supports (and Nemesis requires) certificate-based client authentication as well as the presentation of the server's Certificate Authority (CA) certificate. While the user may choose to use a self-signed certificate with Nemesis, the self-signed certificate must be the CA certificate used to sign the client and/or server certificates. In time, Nemesis may include scripts to generate a simple PKI for these self-signed moments.
*The global logger instance (root.logger) write messages as the application itself. *Any time init() is called, it will make sure a global instance exists and if not it will initialize the same.
*Each package or other object can create a local logger instance by calling--
local_logger=root.packages.logger(source,pid);*When the local logger is created-- **The local logger has its own handle to write to SYSLOG/console. **The local logger has its own sourceString.
Fully Qualified Method Name | Arguments | Description |
---|---|---|
log(messageJSON) |
messageJSON:JSON object describing a log message { source:'[source]', facility:'[facility]', priority:'[priority]', message:'[message_string]' } |
This method overloads screen.log() to write the input JSON object to the logger.syslog.write() method. This will also change the default source, facility and priority of the logger. |
log(message) | message:string containing message | This method overloads screen.log() to write the input message string to the logger.syslog.write() method. Writes to this method will use the current source, facility and priority of the logger. |
logger.syslog.write(source,facility,priority,message) |
source:string facility:string priority:string message:string with less than 1024 characters |
This method writes to the syslog server, establishing the TLS connection and sending the payload message. |
Property | Type | Description |
---|---|---|
screen | Object | Defines the syslog screen configuration group. |
screen.minDisplayPriority | Number | Defines the minimum priority level below which log messages will be written to stdout. See SYSLOG Documentation. |
syslog | Object | Defines the syslog server definition |
syslog.minDisplayPriority | Number | Defines the minimum priority level below which log messages will be written to stdout. See SYSLOG Documentation. |
syslog.ip | String | Defines the syslog server IPv4 address |
syslog.port | Number | Defines the TCP Port number (e.g. 514) used for SYSLOG messages |
syslog.tls | Object | Defines the TLS encryption configuration. |
syslog.tls.key | String | Defines the path/filename to the TLS Private key |
syslog.tls.cert | String | Defines the path/filename to the TLS Client Certificate |
syslog.tls.ca | String | Defines the path/filename to the TLS CA Certificate shared between the client and server. |