Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including log4js-logstash-redis with all npm packages installed. Try it out:

var log4jsLogstashRedis = require("log4js-logstash-redis")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

log4js-logstash-redis v1.2.0

A simple log appender for log4js that sends the data to logstash by redis.

log4js-logstash-redis

node version build status David deps

A simple log appender for log4js that sends the data to logstash by redis.

Installation

npm install log4js-logstash-redis --save

Usage: logstash configuration

In the "input" part of the logstash server conf :

input {
  redis {
    codec => json
    data_type => "list"
    key => "YOURKEY"
  }
}

Usage: log4js configuration

Plain javascript

const log4js = require('log4js');
log4js.configure({
  appenders: {
    logstash_redis: {
      type: 'log4js-logstash-redis',
      key: 'YOURKEY',
      redis: {
        host: 'localhost',
        port: 6379,
        db: 0 // default 0
      },
    },
  },
  categories: { default: { appenders: [ 'logstash_redis' ], level: 'debug' }}
});

const logger = log4js.getLogger();

logger.debug('hello hello');
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free