rabbitmq-server
rabbitmq-server copied to clipboard
log.file.rotation.date syntax supports a limited number of options compared to Lager
in config file the line log.file.rotation.date = $D0 is working fine whereas the $D12H30 or anything other than day is causing a failure to start service. I'm using rabbitmq-server=3.9.11-1 and erlang/bionic 1:24.1.7-1 and primary configuration file format.
The error log :
Application rabbit exited with reason: {{cannot_log_to_file,unknown,{callback_crashed,{error,{case_clause,{0,[]}},[{rabbit_logger_std
,application_controller,"{application_start_failure,rabbit,{{cannot_log_to_file,unknown,{callback_crashed,{error,{case_clause,{0,[]}},[{rabbit_logger_std_h,pa
pplication_controller) ({application_start_failure,rabbit,{{cannot_log_to_file,unknown,{callback_crashed,{error,{case_clause,{0,[]}},[{rabbit_logger_std_h,par
parse_date_spec/1 misses clauses for $H:
parse_date_spec(false) ->
false;
parse_date_spec("") ->
false;
parse_date_spec([$$,$D | DateSpec]) ->
io:format(standard_error, "parse_date_spec: ~p (hour)~n", [DateSpec]),
parse_hour(DateSpec, #{every=>day,
hour=>0});
parse_date_spec([$$,$W | DateSpec]) ->
io:format(standard_error, "parse_date_spec: ~p (week)~n", [DateSpec]),
parse_day_of_week(DateSpec, #{every=>week,
hour=>0});
parse_date_spec([$$,$M | DateSpec]) ->
io:format(standard_error, "parse_date_spec: ~p (month)~n", [DateSpec]),
parse_day_of_month(DateSpec, #{every=>month,
hour=>0});
parse_date_spec(DateSpec) ->
io:format(standard_error, "parse_date_spec: ~p (error)~n", [DateSpec]),
error.
@dumbbell is there a reason for that?
The function logs to standard error, which for this setting doesn't seem to be necessary.
The following examples from the doc fail with various function clauses. It's not specific to Debian:
log.file.rotation.date = $W5D16
log.file.rotation.date = $H00
From the looks of some portions of the parser and docs, my guess is that the format documentation predates the standard OTP logger transition. All those values were supported by Lager but the current implementation is a lot more limited.
https://rabbitmq.com/logging.html#log-rotation no longer documents what we do not support. On Linux, logrotate should be an easily accessible option which would always be superior to anything that built-in rotation ever provides. So use that.
https://groups.google.com/g/rabbitmq-users/c/lxcH6Nk17as
Fixed by #3835