Skip to content

Commit ca55dc9

Browse files
authored
Merge pull request #1658 from rabbitmq/lrb-add-hostname-syslog-support
Add support for syslog server hostname
2 parents b211e28 + 033339a commit ca55dc9

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ BUILD_DEPS = rabbitmq_cli
136136
DEPS = ranch syslog lager rabbit_common
137137
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper
138138

139-
dep_syslog = git https://github.com/schlagert/syslog 3.4.2
139+
dep_syslog = git https://github.com/schlagert/syslog 3.4.3
140140

141141
define usage_xml_to_erl
142142
$(subst __,_,$(patsubst $(DOCS_DIR)/rabbitmq%.1.xml, src/rabbit_%_usage.erl, $(subst -,_,$(1))))

priv/schema/rabbit.schema

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,7 @@ end}.
10671067
{mapping, "log.syslog", "rabbit.log.syslog.enabled", [
10681068
{datatype, {enum, [true, false]}}
10691069
]}.
1070+
10701071
{mapping, "log.syslog.level", "rabbit.log.syslog.level", [
10711072
{datatype, {enum, [debug, info, notice, warning, error, critical, alert, emergency, none]}}
10721073
]}.
@@ -1091,6 +1092,26 @@ end}.
10911092
{validators, ["is_ip"]}
10921093
]}.
10931094

1095+
{mapping, "log.syslog.host", "syslog.dest_host", [
1096+
{datatype, string}
1097+
]}.
1098+
1099+
{translation, "syslog.dest_host",
1100+
fun(Conf) ->
1101+
case cuttlefish:conf_get("log.syslog", Conf) of
1102+
true ->
1103+
case cuttlefish:conf_get("log.syslog.ip", Conf, undefined) of
1104+
undefined ->
1105+
% If log.syslog.ip is not set, then this must be set
1106+
cuttlefish:conf_get("log.syslog.host", Conf);
1107+
IpAddr ->
1108+
IpAddr
1109+
end;
1110+
_ ->
1111+
cuttlefish:invalid("log.syslog must be set to true to set log.syslog.host or log.syslog.ip")
1112+
end
1113+
end}.
1114+
10941115
{mapping, "log.syslog.port", "syslog.dest_port", [
10951116
{datatype, integer}
10961117
]}.

test/config_schema_SUITE_data/rabbit.snippets

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,12 @@ credential_validator.regexp = ^abc\\d+",
554554
{log_syslog_tcp,
555555
"log.syslog = true
556556
log.syslog.transport = tcp
557-
log.syslog.protocol = rfc5424",
557+
log.syslog.protocol = rfc5424
558+
log.syslog.host = syslog.my-network.com",
558559
[
559560
{rabbit,[{log, [{syslog, [{enabled, true}]}]}]},
560-
{syslog, [{protocol, {rfc5424, tcp}}]}
561+
{syslog, [{protocol, {rfc5424, tcp}},
562+
{dest_host, "syslog.my-network.com"}]}
561563
],
562564
[]},
563565
{log_syslog_udp_default,

0 commit comments

Comments
 (0)