From 63ca9cc9c3d62833c817009fbd445988b4782baf Mon Sep 17 00:00:00 2001 From: Mayo Date: Tue, 22 Mar 2022 20:01:40 +0800 Subject: [PATCH] Revert "fix(syslog) ensure new facility field is compatible with older versions in hybrid mode (#7477)" This reverts commit 15908e4dd1a0ae1b09d9807e702aa788f17f6461. --- kong/plugins/syslog/handler.lua | 10 +++------- kong/plugins/syslog/schema.lua | 2 ++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/kong/plugins/syslog/handler.lua b/kong/plugins/syslog/handler.lua index 711434ce2aed..b0a300b97ef5 100644 --- a/kong/plugins/syslog/handler.lua +++ b/kong/plugins/syslog/handler.lua @@ -71,18 +71,14 @@ local function log(premature, conf, message) return end - -- TODO: revert this commit and use schema to populate default value - -- in 2.7 or 3.0 whichever comes eearlier. - local facility = conf.facility or "user" - if message.response.status >= 500 then - send_to_syslog(conf.log_level, conf.server_errors_severity, message, facility) + send_to_syslog(conf.log_level, conf.server_errors_severity, message, conf.facility) elseif message.response.status >= 400 then - send_to_syslog(conf.log_level, conf.client_errors_severity, message, facility) + send_to_syslog(conf.log_level, conf.client_errors_severity, message, conf.facility) else - send_to_syslog(conf.log_level, conf.successful_severity, message, facility) + send_to_syslog(conf.log_level, conf.successful_severity, message, conf.facility) end end diff --git a/kong/plugins/syslog/schema.lua b/kong/plugins/syslog/schema.lua index e744603c72b7..8b4963d9d3d4 100644 --- a/kong/plugins/syslog/schema.lua +++ b/kong/plugins/syslog/schema.lua @@ -10,6 +10,8 @@ local severity = { local facility = { type = "string", + default = "user", + required = true, one_of = { "auth", "authpriv", "cron", "daemon", "ftp", "kern", "lpr", "mail", "news", "syslog", "user", "uucp",