log4js-logstash-appender
A simple log4js appender that sends a JSON-object to a Logstash server.
Where can I find the releases?
You can install it using npm. Exampel package.json file:
"dependencies": "log4js": "0.6.22" "log4js-logstash-appender": "1.0.0"
Usage (log4js configuration)
"appenders": "type": "log4js-logstash-appender" "host": "127.0.0.1" "port": 12345 "application": "MyApplication" "environment": "Production"
How do I utilize MDC (Mapped Diagnostic Context)?
log4js-logstash-appender utilizes continuation-local-storage to provide an MDC. It requires the MDC to be bound to a context or callback. Here is an example of how this is done using an express-application, where we bind the request and response event emitters to the MDC context:
var express = ;var uuid = ;var MDC = MDC; var app = ; app;