1.0.3-rc1 • Published 1 year ago

@teragrep/rlo_08 v1.0.3-rc1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

Teragrep Logo

Syslog Javascript Client

RLO_08

Client Library written in Javascript to send messages to a Syslog server

Generate the Syslog messages

let message = new SyslogMessage.Builder()
        .withAppName('bulk-data-sorted')
        //.withTimestamp(timestamp) // In case if the timestamp disabled, it will go with system timestamp.
        .withHostname('iris.teragrep.com')
        .withFacility(Facility.LOCAL0)
        .withSeverity(Severity.INFORMATIONAL)
        .withProcId('8740')
        .withMsgId('ID47')
        .withMsg('Don’t test it as NÀSÀ¶¶ Àpplication') // Fixed: Problem with handling utf8 characters.
        .withSDElement(new SDElement("exampleSDID@32473", new SDParam("iut", "3"), new SDParam("eventSource", "Àpplication"))) //Updated support for UTF-8 
        .build()

RLP_02 Integration & Configuration

Install RLP_02

npm install @teragrep/rlp_02

RLP_02 RelpConnection configuration & usage

let relpConnection = new RelpConnection();
let host = '127.0.0.1';
let port = <<SET YOUR PORT#>>;
 
 
async.waterfall(
    [
        function init(setConnect) {
            setConnect(null, port, host)
        },
        connect,
        load,
        commit,
        disconnect
 
    ],
    function (err) {
        if(err) {
            console.log(err);
        }
        else {
            console.log('No Error')
        }
    }
)
async function connect() {
    let conn = await relpConnection.connect(cfePort, host);
    return conn;
}
 
async function disconnect(state) {
if(state){
     await relpConnection.disconnect();
}
else {
    console.log('Check the connection...')
  }
}