[GitHub] [apisix] bisakhmondal commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping
bisakhmondal commented on a change in pull request #6228: URL: https://github.com/apache/apisix/pull/6228#discussion_r800351711 ## File path: apisix/plugins/loggly.lua ## @@ -184,9 +202,18 @@ local function generate_log_message(conf, ctx) core.table.insert(taglist, "tag=\"" .. conf.tags[i] .. "\"") end end + +local message_severity = severity[conf.severity:upper()] Review comment: Done -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] bisakhmondal commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping
bisakhmondal commented on a change in pull request #6228: URL: https://github.com/apache/apisix/pull/6228#discussion_r800351756 ## File path: apisix/plugins/loggly.lua ## @@ -145,6 +150,19 @@ function _M.check_schema(conf, schema_type) if not ok then return nil, err end + +if conf.severity_map then +for k, v in pairs(conf.severity_map) do +local rcode = tonumber(k) Review comment: Done -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] bisakhmondal commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping
bisakhmondal commented on a change in pull request #6228: URL: https://github.com/apache/apisix/pull/6228#discussion_r801290704 ## 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: Yea, I had tested. It doesn't work that way. say for eg, `["^[1-5][0-9]{2}"] = {...}` the check schema match the enums for only the set of keys where the key is a status code (regex). For other scenarios (key = "ABC", "500a") there is no matching regex, so it simply doesn't match and validate with the pattern and let it pass as valid inputs. -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] bisakhmondal commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping
bisakhmondal commented on a change in pull request #6228: URL: https://github.com/apache/apisix/pull/6228#discussion_r801290899 ## 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: I think I avoid that due to the default behaviour of cjson encoding `Cannot serialise table: excessively sparse array`. we can override the behaviour by `cjson.encode_sparse_array(true)`. In this case, I thought I don't need it that's why I am sticking with strings. WDYT? -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] bisakhmondal commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping
bisakhmondal commented on a change in pull request #6228: URL: https://github.com/apache/apisix/pull/6228#discussion_r803310088 ## 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: @spacewander It works as well as doesn't work. Example 1: Want :heavy_check_mark: Got: :heavy_check_mark: ```json ... "severity_map": { "200": "INFO" } ... ``` Example 2: Want :x: Got: :x: ```json ... "severity_map": { "200": "abc" } ... ``` Example 3: Want :x: Got: :heavy_check_mark: : ```json ... "severity_map": { "abc": "def" } ... ``` The problem is, if the key fails to match regex, the pattern properties don't get applied. Also, the program doesn't throw an error for the key mismatch. -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] bisakhmondal commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping
bisakhmondal commented on a change in pull request #6228: URL: https://github.com/apache/apisix/pull/6228#discussion_r805404708 ## 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: It worked! Awesome : ) ``` // inp "severity_map": { // "abc": "def" //} { "error_msg": "failed to check the configuration of plugin loggly err: property \"severity_map\" validation failed: additional properties forbidden, found abc" } ``` -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] bisakhmondal commented on a change in pull request #6228: feat(loggly): support HTTP response code to SYSLOG severity mapping
bisakhmondal commented on a change in pull request #6228: URL: https://github.com/apache/apisix/pull/6228#discussion_r805404708 ## 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: It worked! Awesome : ) ``` // inp "severity_map": { // "abc": "def" //} { "error_msg": "failed to check the configuration of plugin loggly err: property \"severity_map\" validation failed: additional properties forbidden, found abc" } ``` -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org