Create appender for log4js-node to enable RELP usage from node.js applications.
User Story: As a developer I would like to use jsa_01 to push log messages over relp to a compatible relp-server with syslog envelope
Requirements Backlog
# | Title | User Story | Importance | Status |
---|---|---|---|---|
1 |
Rebind |
Rebind of the rlp_02 connection must be done after configureable amount of messages |
OPTIONAL |
Open |
2 |
Syslog |
Wrap messages in syslog envelope |
Must Have |
WIP |
3 |
RELP |
Use rlp_02 library |
Must Have |
Done |
4 |
Lossless |
Retry indefinitely and do not lose messages |
Must Have |
Open |
5 |
Robust |
Processing must not hang indefinitely due to techinical issues but rather retry new connection |
Must Have |
Open |
6 |
Source Data |
Must include origin data in syslog structure-data within source-metadata |
Must Have |
WIP |
7 |
Originator |
Must include hostname within new syslog structured-data (SD) so utilization systems can utilize it |
Must Have |
Done |
8 |
app-name |
Syslog app-name must be configureable |
Must Have |
Done |
9 |
hostname |
syslog hostname must be configureable |
Must Have |
Done |
10 |
server port |
Server ports need to be configureable |
Must Have |
Done |
11 |
Server address |
server address needs to be configureable |
Must Have |
Done |
12 |
Expose error SyslogMessage |
Erros(expecptions) must not be hidden |
Must Have |
Open |
13 |
Extra libraries |
Do not use extra libraries |
Must Have |
Open |
14 |
Variable checking |
Check variables provided via configuration to be valid and raise errors if not in initilization |
Must Have |
Done |
15 |
Debug flags |
Allow passing debulg flags via configuration |
OPTIONAL |
Open |
The jsAppender to push log messages over relp to a compatible relp-server with syslog envelope.
Use following components for:
-
rlp_02: RELP connection
-
rlo_08: Generate the Syslog message
-
Java-relp-server-demo: RELP compatible server (tested on)
How to implement:
-
asynchronus behaviour completely controlled by the Jasmine async works.
npm install
-
Module usage:
The appender uses the rlo_08 for handling formatting log messages and rlp_02 to send the log event message to the RELP Server.
const { SyslogMessage, Facility, SDElement, SDParam, Severity } = require('@teragrep/rlo_08') const { RelpConnection, RelpBatch } = require('@teragrep/rlp_02')
-
Build
mvn clean package
-
Optional tips:
async waterfall method also possible for run in the node engine (need to adjust the code).
-
type
-jsAppender
-
hostname
-string
(defaults to os.hostname()) - origin of the log messages -
appname
-string
-
serverAddress
-string
-
serverPort
-integer
(defaults to 1601) - Port of the relp server is listening in
log4js.configure( {
appenders: {jsa: { type: jsAppender, appName: 'teragrep' },
console: { type: 'console' },
},
categories: {
jsa: { appenders: ['jsa'], level: 'error' },
default: { appenders: ['jsa'], level: 'trace' },
},
})
This configuration will send the log event messages to the RELP Server.
You can involve yourself with our project by opening an issue or submitting a pull request.
Contribution requirements:
-
All changes must be accompanied by a new or changed test. If you think testing is not required in your pull request, include a sufficient explanation as why you think so.
-
Security checks must pass
-
Pull requests must align with the principles and values of extreme programming.
-
Pull requests must follow the principles of Object Thinking and Elegant Objects (EO).
Read more in our Contributing Guideline.
Contributors must sign Teragrep Contributor License Agreement before a pull request is accepted to organization’s repositories.
You need to submit the CLA only once. After submitting the CLA you can contribute to all Teragrep’s repositories.