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
- Host: GitHub
- URL: https://github.com/teragrep/javascript-logging-demo
- Owner: teragrep
- License: apache-2.0
- Created: 2022-07-22T08:39:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-12T12:38:02.000Z (about 2 years ago)
- Last Synced: 2024-04-17T19:13:15.877Z (over 1 year ago)
- Topics: demo, javascript, relp, relp-client, syslog-client
- Language: JavaScript
- Homepage:
- Size: 790 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
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
-----------------