How to handle RabbitMQ Logs?

18,623

Solution 1

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.

Solution 2

You can use rabbitmqctl rotate_logs

Instruct the RabbitMQ node to rotate the log files.

then delete the OLD files

Solution 3

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

Share:
18,623
Razze
Author by

Razze

C# programming for a living. With a heavy focus on a mssql database. Doing various other things programming related things at home, for fun.

Updated on June 27, 2022

Comments

  • Razze
    Razze almost 2 years

    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
    Razze over 7 years
    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
    Razze over 7 years
    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
    Razze over 7 years
    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?
  • Alex Buyny
    Alex Buyny over 7 years
    @Razze yes you can do that