/logsene-js

Log Shipper for sending logs to Logsene from JavaScript apps

Primary LanguageJavaScriptApache License 2.0Apache-2.0

JavaScript client for Logsene. Register for a free account or Login to Logsene to create an App Token.

Installation

npm install logsene-js --save

Usage

var Logsene = require('logsene-js')
var logger =  new Logsene ('LOGSENE-APP-TOKEN')
logger.log ('info', 'text message', {tags: ['a','b'], customField: 'custom-field'})

Constructor Parameters

  • token - Create your free account and access token here.
  • type - Optional. Default type of your logs - please note you can define Elasticsearch mapping templates in Logsene
  • url - Logsene receiver URL (e.g. for Logsene On Premises), defaults to 'https://logsene-receiver.sematext.com/_bulk'

Environment variables

  • LOGSENE_TMP_DIR - Directory to store failed bulk requests, for later re-transmission. Failed requests are not stored, when LOGSENE_TMP_DIR is not set.
  • LOGSENE_LOG_INTERVAL - Time to collect logs before a bulk request is done. Default 10000 ms
  • LOGSENE_BULK_SIZE - Maximum size of a bulk request. Default 1000.
  • LOGSENE_URL - URL for the Logsene receiver. E.g. for On-Premise version. Defaults to Sematext Logsene SaaS receiver https://logsene-receiver.sematext.com/_bulk

Security

  • HTTPS is enabled by default
  • Environment variables for Proxy servers:
    • For HTTPS endpoints (default): HTTPS_PROXY / https_proxy
        export HTTPS_PROXY=https://my-ssl-proxy.example
        export HTTPS_PROXY=http://my-proxy.example
  • For HTTP endpoints (e.g. On-Premises): HTTP_PROXY / http_proxy
        export HTTP_PROXY=http://my-proxy.example
        export HTTP_PROXY=https://my-ssl-proxy.example

Other related modules

Please check winston-logsene a transport layer for the winston logging framework.