You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/08 02:54:29 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping

spacewander commented on a change in pull request #6228:
URL: https://github.com/apache/apisix/pull/6228#discussion_r801226395



##########
File path: apisix/plugins/loggly.lua
##########
@@ -85,6 +86,17 @@ local schema = {
             type = "boolean",
             default = true
         },
+        severity_map = {
+            type = "object",
+            description = "upstream response code vs syslog severity mapping",
+            patternProperties = {
+                [".*"] = {

Review comment:
       We can use regex to verify the range of status code?

##########
File path: apisix/plugins/loggly.lua
##########
@@ -145,6 +157,18 @@ function _M.check_schema(conf, schema_type)
     if not ok then
         return nil, err
     end
+
+    if conf.severity_map then
+        local cache = {}
+        for k, v in pairs(conf.severity_map) do
+            local rcode = tonumber(k)
+            if not rcode or rcode < 100 or rcode >= 600 then
+                return nil, "expecting severity_map with http response code([100,599]) as keys"
+            end
+            cache[k] = severity[v:upper()]

Review comment:
       We can convert k to a number?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org