Skip to content

teragrep/javascript-logging-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Architecture

Implementation

  • Package.json installation of rlp_02 and rlo_08

    npm install
  • Module usage:

    const { SyslogMessage, Facility, SDElement, SDParam, Severity } = require('@teragrep/rlo_08')
    const { RelpConnection, RelpBatch } = require('@teragrep/rlp_02')
  • RelpConnection usage:

    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

      java -jar java-relp-server-demo-jar-with-dependencies.jar
    • Build

      mvn clean package
  • OPTIONAL TIPS

    • You can run the test-server and make curl request to the server listening port at 3000

    • * Run Server:

      node test-server.js
    • CURL request to the our test server running on PORT 3000

      curl localhost:3000/ua