An open API service indexing awesome lists of open source software.

https://github.com/teragrep/javascript-logging-demo


https://github.com/teragrep/javascript-logging-demo

demo javascript relp relp-client syslog-client

Last synced: 13 days ago
JSON representation

Awesome Lists containing this project

README

          

# javascript-logging-demo

User Story: As a dev/customer I would like to know how the rlo_08 + rlp_02 do work together in a real application

* Demo web client app sends the HTTP request message (message1) to the node server
* Server uses the RLO_08 library to build the Syslog message including the User Agent details from the Demo web client app and send HTTP response for the demo web client app request
** log the user agent used in the request
* Display the syslog message with rlp_03 example application (https://github.com/teragrep/java-relp-server-demo)
* Use github workflow to setup the environment:
** Launch the rlp_03 for listening data
*** Show logged lines of the rlp_03
** Launch server with rlo_08 and rlp_02
*** RELP Connection should be kept online for sending meaning not connect and disconnect for each message.
** Launch demo web client app
*** Make request

== High-level Architecture
image::https://github.com/teragrep/javascript-logging-demo/blob/base-feat/images/rlo_08_demo_arch.png[alt="Architecture",width=700,height=400]

== Implementation

* `Package.json installation of *rlp_02 and rlo_08*`
+
[source,node]
-----------------
npm install
-----------------

* Module usage:
+
[source,javascript]
-----------------
const { SyslogMessage, Facility, SDElement, SDParam, Severity } = require('@teragrep/rlo_08')
const { RelpConnection, RelpBatch } = require('@teragrep/rlp_02')
-----------------

* RelpConnection usage:
+
[source,javascript]
-----------------
async function setupConnection(port, host){
return new Promise(async (resolve, reject) => {
relpConnection = new RelpConnection();
let conn = await relpConnection.connect(port, host);
console.log('Connectig...',host,' at PORT ', port)
resolve(relpConnection)
})
}
-----------------

* `Runtime *INSTRUCTIONS*`
** First, Make sure that run our java-relp-server-demo application jar
+
[source,java]
-----------------
java -jar java-relp-server-demo-jar-with-dependencies.jar
-----------------

** Build
+
[source,java]
-----------------
mvn clean package
-----------------

* OPTIONAL *TIPS*
** You can run the test-server and make curl request to the server listening port at 3000
** * Run Server:
+
[source,javascript]
-----------------
node test-server.js
-----------------

** CURL request to the our test server running on PORT 3000
+
[source,shell]
-----------------
curl localhost:3000/ua
-----------------