mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
1.7 KiB
1.7 KiB
Rabbitmq Appender
Push log events to a Rabbitmq MQ. You will need to include the amqplib package in your application's dependencies to use this appender.
Configuration
type-rabbitmqhost-string(optional, defaults to127.0.0.1) - the location of the rabbitmq serverport-integer(optional, defaults to5672) - the port the rabbitmq server is listening onusername-string(optional, defaults toguest) - username to use when authenticating connection to rabbitmqpassword-string(optional, defaults toguest) - password to use when authenticating connection to rabbitmqrouting_key-string(optional, defaults tologstash) - rabbitmq message's routing_keydurable-string(optional, defaults to false) - will that RabbitMQ lose our queue.exchange-string- rabbitmq send message's exchangemq_type-string- rabbitmq message's mq_typelayout-object(optional, defaults tomessagePassThroughLayout) - the layout to use for log events (see layouts).
The appender will use the Rabbitmq Routing model command to send the log event messages to the channel.
Example
log4js.configure({
appenders: {
mq: {
type: 'rabbitmq',
host: '127.0.0.1',
port: 5672,
username: 'guest',
password: 'guest',
routing_key: 'logstash',
exchange: 'exchange_logs',
mq_type: 'direct',
durable: true
}
},
categories: { default: { appenders: ['mq'], level: 'info' } }
});
This configuration will push log messages to the rabbitmq on 127.0.0.1:5672.