My rabbit logs are getting very large and I am wondering if there is a better way to control the rotation. I'd like the logs to rotate based on size, and to keep at most ten logs at a time. The best I've found so far is that you can turn off logging by putting SERVER_START_ARGS="-kernel error_logger silent"
into the rabbitmq.conf file. Is there a better way? I'd like to avoid using a crontab for this.
The best choice is put the log rotate logical inside your rabbitmq.conf file like below:
{log, [
{file, [{file, "/var/log/rabbitmq/rabbitmq.log"}, %% log.file
{level, info}, %% log.file.info
{date, "$D0"}, %% log.file.rotation.date
{size, 1024}, %% log.file.rotation.size
{count, 15} %% log.file.rotation.count
]}
]},
I think the best way is to use a config file. I tried above ways but they didn't work for me. I used the following configuration from here and it worked:
{lager, [
{handlers, [
{lager_file_backend, [{file, "rabbit.log"},
{level, info},
{date, "$D0"},
{size, 10},
{count, 2}
]}]}
]},
You can find info on what does date, size and count do in this link https://github.com/basho/lager
You can use the command .
rabbitmqctl rotate_logs
Its working for me. Read more from the http://www.rabbitmq.com/configure.html
Hope it will help you.
The best way to do this is to upgrade to RabbitMQ 2.4.1. A lot of people are still running very old and obsolete RabbitMQ software that has problems with large persister logs. Newer versions handle this much better, and they also have a management plugin (web accessible) and much faster message routing.
Ideally you would upgrade to Erlang R14B02 first, then upgrade RabbitMQ.
Skip Erlang R14B03 if you are going to compile RabbitMQ from source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With