Retail Pro Prism 2.3 RabbitMQ Log Rotation Best Practices

Applies to:

RabbitMQ server 3.12.10 and above, Retail Pro Prism 2.3 and above

Problem

The RabbitMQ log grows very large over a short period of time. By default, RabbitMQ logs all messages, including info, to a single file, causing the file to grow too large to be useful.

Cause

The default behavior of RabbitMQ logging is to record various warnings, connection information, and errors. This results in a log that grows very quickly.

Solution

Modify the rabbitmq.config file to configure the RabbitMQ service to record only errors in the log. This will save space and make the logs more manageable. Follow the steps below:

1. Edit the Configuration File:

Navigate to C:\ProgramData\RetailPro\server\rabbitMQ.
Edit the rabbitmq.config file. Its initial contents will just be []. If the file does not exist, create a new text file named rabbitmq.config.

Replace the content with the following:


## Logging settings.
##
## See https://rabbitmq.com/logging.html and https://github.com/erlang-lager/lager for details.
##

## Log directory, taken from the RABBITMQ_LOG_BASE env variable by default.
##
# log.dir = c:\

## Logging to file. Can be false or a filename.
## Default:
log.file = RabbitMQRotate.log

## To disable logging to a file
## log.file = false

## Log level for file logging
##
log.file.level = error

## File rotation config. No rotation by default.
## DO NOT SET rotation date to ''. Leave the value unset if "" is the desired value
# log.file.rotation.date = $D0
log.file.rotation.size = 1048500
log.file.rotation.count = 10

## Logging to console (can be true or false)
##
# log.console = false

## Log level for console logging
##
# log.console.level = info

## Logging to the amq.rabbitmq.log exchange (can be true or false)
##
# log.exchange = false

## Log level to use when logging into the amq.rabbitmq.log exchange
##
# log.exchange.level = info

 

2. Save the File.

3. Stop the RabbitMQ Service:

Use the Windows Service Manager to stop the RabbitMQ service.

4. Delete Existing Logs:

Delete the existing RabbitMQ logs in C:\ProgramData\RetailPro\server\rabbitMQ\log.

5. Restart Your Retail Pro Prism Server:

Restart the Retail Pro Prism server to apply the changes.

The RabbitMQ service will now only record errors. Ten logs will be created as needed and will rotate when errors occur.

 

Customization Options

 

Log File Name:

Change the log file name to include the server's name, e.g., Rabbitlog.log.
Configuration: log.file = rabbitMQRotate.log

Maximum File Size:

Set a maximum size for the log file before creating a new file.
Configuration: log.file.rotation.size = 1048500

Log File Rotation Count:

Set the maximum number of log files to be created. When a log file reaches its maximum size, it will overwrite the oldest existing log file.
Configuration: log.file.rotation.count = 10

Published on Sep 20, 2024 in Best Practices

 

Find Another Article