8

We're running RabbitMQ and the .log it's writing to the log folder get quiet large.

What's the right thing to do there, can we just delete it from time to time, should we rotate them away and then delete them? I fail to find any documentation on this.

Razze
  • 4,124
  • 3
  • 16
  • 23

4 Answers4

4

Rotating the logs is pretty much the only thing you can do you can use the rotate scheduler to keep them under control.

rabbitmqctl rotate_logs

If you are looking for a different alternative to the plain old log file in rabbitmq, Sematext.com has an excellent log aggregator service that will store, filter, and manage your logs.

John Demian
  • 121
  • 3
3

You can use rabbitmqctl rotate_logs

Instruct the RabbitMQ node to rotate the log files.

then delete the OLD files

Gabriele Santomaggio
  • 21,656
  • 4
  • 52
  • 52
  • I tried that already and it only seems to work via `rabbitmqctl rotate_logs .1` but according to the documentation it only rotates on broker restart? That's only happening if the service gets restarted right? At least on windows. – Razze Jan 18 '17 at 09:49
  • I think it just clicked I need to have a job, which calls rotate_logs and then moves/deletes the old log. And shedule that job to run every now and then? – Razze Jan 18 '17 at 09:51
2

If you want to run log rotation on scheduled basis and archive / delete logs when they grow too big, RabbitMQ has nothing to do it for you out of the box.

If you use Linux to run RabbitMQ you can use logrotate utility. For scheduling this job you can use cron

Alex Buyny
  • 3,047
  • 19
  • 25
  • I think it just clicked I need to have a job, which calls `rabbitmqctl rotate_logs suffix` and then moves/deletes the old log. And shedule that job to run every now and then? – Razze Jan 18 '17 at 09:52
  • @Razze yes you can do that – Alex Buyny Jan 18 '17 at 20:20
0

Older Versions of rabbitmq prior to 3.7 did not have many options to rotate logs. Depending on how your distributed system uses rabbitmq you will see a lot of near useless information messages. If you find that your log file is getting to large you will need to add a config file to stop this.

If prior to 3.7 do the following:

  1. Stop your rabbitmq service.

  2. Go to the directory where rabbitmq is installed and add a plain text rabbitmq.config file with the following:

    [

     {rabbit, [{log_levels,[{connection, error}]}]}
    

    ].

  3. Restart your rabbitmq service.

navarq
  • 1,075
  • 2
  • 15
  • 20