RabbitMQ Log Management Best Practice for Retail Pro Prism

Change your RabbitMQ log level to save hard drive space, reduce administration and backup time. Save time looking at logs for errors.

This article will document log level settings recommended by the Professional Services Team at Retail Pro. You can find additional settings on the RabbitMQ website and on GitHub.

RabbitMQ 3.70 default log level is Info which is one severity below debug. Info-level logging will provide entries in the log tagged as Info, Warning, Error and Critical.

This level of logging is not necessary in a production environment and should be changed to Error in each installation.

RabbitMQ logging and configuration can be changed by editing the RabbitMQ.config file which is in C:\ProgramData\RetailPro\Server\RabbitMQ directory.

The default rabbitmq.config file will look something like this:

RabbitMQ File Example
 

Edit the file and change the contents to reflect the text in the log file below.
 

RabbitMQ Config Edit

 

Text from the above log file:

   [ {lager, [

 

 

{handlers, [

{lager_file_backend, [{file, "error.log"},

{level, error},

{date, "$D0"},

{size, 10485760},

{count, 10}]}

    ]}]}].

 

 

Recommendation

  1. Delete old log files in the C:\ProgramData\RetailPro\Server\RabbitMQ directory.
  2. Save the rabbitmq.config file and restart RabbitMQ Service. Lager (Logging Program) will rotate its own logs.
  3. To use internal rotation, use the size, date and count values in the file backend's configuration:

    [{file, "error.log"}, {level, error}, {size, 10485760}, {date, "$D0"}, {count, 10}]

    Explanation

{file, "error.log"}, {level, error}

Tells lager to log errors and above messages to error.log

{size, 10485760}, {date, "$D0"}

Tells lager to rotate the file at midnight or when it reaches 10mb, whichever comes first

{count, 10}

Tells lager to keep 10 rotated logs in addition to the current one. Setting the count to zero does not disable rotation. Instead, it rotates the file and keeps no previous versions.

{size, 0}, {date, " "}

To disable rotation, set size to zero and the date to " "

 

Syntax

The $D0 syntax is taken from the syntax newsyslog uses in newsyslog.conf. The relevant extract follows.

Day, week, month and time format

 

 

The lead-in character for day, week and month specification is a '$' sign. The particular format of day, week and month specification is: [Dhh], [Ww[Dhh]] and [Mdd[Dhh]], respectively. Hour specification is added on top of this, displayed as [Hmm]. Optional time fields default to midnight.

Range specifications

 

 

w

Day of week

Range 0 ... 6, 0 = Sunday

dd

Day of month

Range: 1 ... 31, or the letter L or l to specify the last day of the month.

hh

Hours

Range: 0 ... 23

mm

Minutes

Range: 0 ... 59

 

Examples

$D0

Rotate every night at midnight

$D23

Rotate every day at 23:00 hr

$W0D23

Rotate every week on Sunday at 23:00 hr

$W5D16

Rotate every week on Friday at 16:00 hr

$M1D0

Rotate on the first day of every month at midnight (i.e., the start of the day)

$M5D6

Rotate on every 5th day of the month at 6:00 hr

$H00

Rotate every hour at HH:00

$D12H30

Rotate every day at 12:30

$W0D0H0

Rotate every week on Sunday at 00:00

Published on Nov 26, 2019 in RP Prism Services

 

Find Another Article