Redis Appender for log4js-node
npm install @log4js-node/redisStores log events in a Redis database. Plugin for log4js > 2.x
``bash`
npm install @log4js-node/redis
* type - redishost
* - string (optional, defaults to 127.0.0.1) - the location of the redis serverport
* - integer (optional, defaults to 6379) - the port the redis server is listening onpass
* - string (optional) - password to use when authenticating connection to redischannel
* - string - the redis channel that log events will be published tolayout
* - object (optional, defaults to messagePassThroughLayout) - the layout to use for log events (see layouts).
The appender will use the Redis PUBLISH command to send the log event messages to the channel.
`javascript`
log4js.configure({
appenders: {
redis: { type: 'redis', channel: 'logs' }
},
categories: { default: { appenders: ['redis'], level: 'info' } }
});
This configuration will publish log messages to the logs channel on 127.0.0.1:6379`.