How to handle RabbitMQ Logs?
Asked Answered
S

4

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.

Socioeconomic answered 17/1, 2017 at 12:18 Comment(0)
D
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.

Detective answered 25/5, 2020 at 0:19 Comment(0)
Z
3

You can use rabbitmqctl rotate_logs

Instruct the RabbitMQ node to rotate the log files.

then delete the OLD files

Zohar answered 17/1, 2017 at 13:15 Comment(2)
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.Socioeconomic
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?Socioeconomic
A
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

Anima answered 18/1, 2017 at 0:57 Comment(2)
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?Socioeconomic
@Socioeconomic yes you can do thatAnima
J
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.

Jadajadd answered 19/11, 2018 at 12:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.