best way to rotate rabbitmq log files

Viewed 17904

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.

4 Answers

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

Related