On 17/11/14 14:36, Peter Lemenkov wrote:
> 2014-11-17 17:29 GMT+03:00 Simon MacMullen <
si...@rabbitmq.com>:
>> I'm afraid RabbitMQ doesn't connect to syslog directly.
>
> Is it possible to log to stdout instead? If yes, then systemd can do
> the trick - it captures everything from stdout/stderr and redirects it
> wherever one wants (Journald, syslog, files, sockets).
It is. Sort of.
You need to hack the rabbitmq-server startup script (which is at
/usr/lib/rabbitmq/lib/rabbitmq_server-X.Y.Z/bin on RPM):
diff -r 0ae3f3b19d40 scripts/rabbitmq-server
--- a/scripts/rabbitmq-server Fri Nov 14 17:41:03 2014 +0000
+++ b/scripts/rabbitmq-server Mon Nov 17 15:36:12 2014 +0000
@@ -94,8 +94,8 @@
${RABBITMQ_LISTEN_ARG} \
-sasl errlog_type error \
-sasl sasl_error_logger false \
- -rabbit error_logger '{file,"'${RABBITMQ_LOGS}'"}' \
- -rabbit sasl_error_logger '{file,"'${RABBITMQ_SASL_LOGS}'"}' \
+ -rabbit error_logger tty \
+ -rabbit sasl_error_logger tty \
-rabbit enabled_plugins_file "\"$RABBITMQ_ENABLED_PLUGINS_FILE\"" \
-rabbit plugins_dir "\"$RABBITMQ_PLUGINS_DIR\"" \
-rabbit plugins_expand_dir "\"$RABBITMQ_PLUGINS_EXPAND_DIR\"" \
and - somewhat irritatingly - it turns out that doing so causes the
management plugin to crash in 3.4.1. That bug will be fixed in 3.4.2
(and I'm pretty sure it was introduced in 3.4.0 since that's when we
started announcing log locations in mgmt).
You then have the slight problem that the native Erlang/RabbitMQ logging
doesn't put one event on a line, so I don't know how much sense systemd
can make of it.
Cheers, Simon