Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for syslog server hostname #1658

Merged
merged 3 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ BUILD_DEPS = rabbitmq_cli
DEPS = ranch syslog lager rabbit_common
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper

dep_syslog = git https://github.com/schlagert/syslog 3.4.2
dep_syslog = git https://github.com/schlagert/syslog 3.4.3

define usage_xml_to_erl
$(subst __,_,$(patsubst $(DOCS_DIR)/rabbitmq%.1.xml, src/rabbit_%_usage.erl, $(subst -,_,$(1))))
Expand Down
21 changes: 21 additions & 0 deletions priv/schema/rabbit.schema
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ end}.
{mapping, "log.syslog", "rabbit.log.syslog.enabled", [
{datatype, {enum, [true, false]}}
]}.

{mapping, "log.syslog.level", "rabbit.log.syslog.level", [
{datatype, {enum, [debug, info, notice, warning, error, critical, alert, emergency, none]}}
]}.
Expand All @@ -1091,6 +1092,26 @@ end}.
{validators, ["is_ip"]}
]}.

{mapping, "log.syslog.host", "syslog.dest_host", [
{datatype, string}
]}.

{translation, "syslog.dest_host",
fun(Conf) ->
case cuttlefish:conf_get("log.syslog", Conf) of
true ->
case cuttlefish:conf_get("log.syslog.ip", Conf, undefined) of
undefined ->
% If log.syslog.ip is not set, then this must be set
cuttlefish:conf_get("log.syslog.host", Conf);
IpAddr ->
IpAddr
end;
_ ->
cuttlefish:invalid("log.syslog must be set to true to set log.syslog.host or log.syslog.ip")
end
end}.

{mapping, "log.syslog.port", "syslog.dest_port", [
{datatype, integer}
]}.
Expand Down
6 changes: 4 additions & 2 deletions test/config_schema_SUITE_data/rabbit.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,12 @@ credential_validator.regexp = ^abc\\d+",
{log_syslog_tcp,
"log.syslog = true
log.syslog.transport = tcp
log.syslog.protocol = rfc5424",
log.syslog.protocol = rfc5424
log.syslog.host = syslog.my-network.com",
[
{rabbit,[{log, [{syslog, [{enabled, true}]}]}]},
{syslog, [{protocol, {rfc5424, tcp}}]}
{syslog, [{protocol, {rfc5424, tcp}},
{dest_host, "syslog.my-network.com"}]}
],
[]},
{log_syslog_udp_default,
Expand Down