Qoncrete NodeJS Client SDK
FOR NodeJS V6.8.0+, PLEASE USE THE OFFICE QONCRETE ES6 SDK: https://github.com/qoncrete/client-sdk-node
This is an ES5 version of Quncrete Server-Side SDK, to provide compatibility for old NodeJS projects.
Installation
Using npm:
npm install qoncrete-sdk-es5
Compilation
Using gulp
./gulp
Output goes into ./dist/index.js
Usage
// 1) Require sdkvar Qsdk = // 2) Create a new client.var client = sourceID: 'SOURCE_ID' apiToken: 'API_TOKEN'// 3) send a logclient
Client Options
var client = sourceID: 'SOURCE_ID' // MANDATORY: The source ID. (Once logged-in, can be found at https://qoncrete.com/account/#!/source) apiToken: 'API_TOKEN'// MANDATORY: The api token. (Once logged-in, can be found at https://qoncrete.com/account/#!/token) {} // A function called on error. Default: (err) => {} secureTransport: false // Send log over SSL. Default: false cacheDNS: true // Active userland dns cache. Default: true" timeoutAfter: 15000 // Abort the query on timeout. Default: 15s retryOnTimeout: 1 // Number of times to resend the log on timeout. Default: 1 (on timeout, it will retry one more time) autoBatch: true // Try to send log by batch instead of sending them one by one. Default: true batchSize: 1000 // Only matters if autoBatch is True. Number of logs to send in a batch. Default: 1000, Max: 1000 autoSendAfter: 2000 // Only matters if autoBatch is True. Time after the logs will be sent if the batch is not full. Default: 2s concurrency: 200 // Number of simultaneous queries that can be made, can be set lower or higher depending your server configuration. Default: 200
Example 1: Send each line of a log file.
Example with a log file that contains one json object per line. on the form:
// test.log// ...
var Qsdk = var readline = var fs = var client = sourceID: 'SOURCE_ID' apiToken: 'API_TOKEN' errorLogger: consoleerrorvar rl = readline rlrl
This is the Node client for qoncrete's custom analytics platform.