Add syslog

This commit is contained in:
turtled 2018-08-27 13:50:38 +08:00
parent 6d2b31911a
commit 91eb79967c
4 changed files with 18 additions and 18 deletions

View File

@ -4,7 +4,7 @@ PROJECT = emqx
PROJECT_DESCRIPTION = EMQ X Broker
PROJECT_VERSION = 3.0
DEPS = jsx gproc gen_rpc lager ekka esockd cowboy clique
DEPS = jsx gproc gen_rpc lager ekka esockd cowboy clique lager_syslog
dep_jsx = git https://github.com/talentdeficit/jsx 2.9.0
dep_gproc = git https://github.com/uwiger/gproc 0.8.0
@ -14,6 +14,7 @@ dep_esockd = git https://github.com/emqx/esockd emqx30
dep_ekka = git https://github.com/emqx/ekka emqx30
dep_cowboy = git https://github.com/ninenines/cowboy 2.4.0
dep_clique = git https://github.com/emqx/clique
dep_lager_syslog = git https://github.com/basho/lager_syslog 3.0.1
NO_AUTOPATCH = gen_rpc cuttlefish

View File

@ -412,7 +412,7 @@ log.syslog = on
## Sets the severity level for syslog.
##
## Value: debug | info | notice | warning | error | critical | alert | emergency
## log.syslog.level = error
log.syslog.level = error
##--------------------------------------------------------------------
## Authentication/Access Control

View File

@ -442,12 +442,12 @@ end}.
]}.
{mapping, "log.syslog", "lager.handlers", [
%%{default, off},
{default, off},
{datatype, flag}
]}.
{mapping, "log.syslog.identity", "lager.handlers", [
{default, "emqx"},
{default, "emqttd"},
{datatype, string}
]}.
@ -456,10 +456,10 @@ end}.
{datatype, {enum, [daemon, local0, local1, local2, local3, local4, local5, local6, local7]}}
]}.
%%{mapping, "log.syslog.level", "lager.handlers", [
%% {default, error},
%% {datatype, {enum, [debug, info, notice, warning, error, critical, alert, emergency]}}
%%]}.
{mapping, "log.syslog.level", "lager.handlers", [
{default, error},
{datatype, {enum, [debug, info, notice, warning, error, critical, alert, emergency]}}
]}.
{mapping, "log.error.redirect", "lager.error_logger_redirect", [
{default, on},
@ -511,14 +511,13 @@ end}.
both -> [ConsoleHandler, ConsoleFileHandler];
_ -> []
end,
SyslogHandler = [],
%%case cuttlefish:conf_get("log.syslog", Conf, false) of
%% false -> [];
%% true -> [{lager_syslog_backend,
%% [cuttlefish:conf_get("log.syslog.identity", Conf),
%% cuttlefish:conf_get("log.syslog.facility", Conf),
%% cuttlefish:conf_get("log.syslog.level", Conf)]}]
%%end,
SyslogHandler = case cuttlefish:conf_get("log.syslog", Conf) of
false -> [];
true -> [{lager_syslog_backend,
[cuttlefish:conf_get("log.syslog.identity", Conf),
cuttlefish:conf_get("log.syslog.facility", Conf),
cuttlefish:conf_get("log.syslog.level", Conf)]}]
end,
ConsoleHandlers ++ ErrorHandler ++ InfoHandler ++ SyslogHandler
end
}.

View File

@ -3,8 +3,8 @@
{vsn,"3.0"},
{modules,[]},
{registered,[emqx_sup]},
{applications,[kernel,stdlib,jsx,gproc,gen_rpc,lager,esockd,cowboy
]},
{applications,[kernel,stdlib,jsx,gproc,gen_rpc,lager,esockd,
cowboy,lager_syslog]},
{env,[]},
{mod,{emqx_app,[]}},
{maintainers,["Feng Lee <feng@emqx.io>"]},