mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: Add exception class/message to DiscourseLogstashLogger
take 2 (#27815)
This is the second take of af2bd4cc5097501ff0f11f497b8d6f6984cea9ae to account for messages which contains newlines.
This commit is contained in:

committed by
GitHub

parent
0b64cb9d8c
commit
b4b7fa17af
@ -83,9 +83,9 @@ class DiscourseLogstashLogger < Logger
|
||||
#
|
||||
# In theory we could get logster to include the exception class and message in opts but logster currently does not
|
||||
# need those options so we are parsing it from the message for now and not making a change in logster.
|
||||
if progname == "web-exception" && message =~ /^(\w+) \((.+)\)\n/
|
||||
if progname == "web-exception" && message =~ /\A([^\(\)]+)\s{1}\(([\s\S]+)\)/
|
||||
event["exception.class"] = $1
|
||||
event["exception.message"] = $2
|
||||
event["exception.message"] = $2.strip
|
||||
end
|
||||
|
||||
if (env = opts&.dig(:env)).present?
|
||||
|
Reference in New Issue
Block a user