mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 09:22:42 +08:00
DEV: Apply Logster.store.ignore
to DiscourseLogstashLogger
as well (#27819)
This commit updates `DiscourseLogstashLogger#add_with_opts` to avoid logging messages that matches regexp patterns configured in `Logster.store.ignore`. Those error logs are mostly triggered by clients and do not serve any useful purpose.
This commit is contained in:

committed by
GitHub

parent
d4c603984f
commit
c9775d5f72
@ -173,5 +173,21 @@ RSpec.describe DiscourseLogstashLogger do
|
||||
|
||||
expect(parsed).not_to have_key("request.headers.some_random_header")
|
||||
end
|
||||
|
||||
it "does not log the event if message matches a pattern configured by `Logster.store.ignore`" do
|
||||
original_logster_store_ignore = Logster.store.ignore
|
||||
Logster.store.ignore = [/^Some::StandardError/]
|
||||
|
||||
logger.add(
|
||||
Logger::ERROR,
|
||||
"Some::StandardError (this is a normal message)\ntest",
|
||||
"web-exception",
|
||||
)
|
||||
|
||||
output.rewind
|
||||
expect(output.read.chomp).to be_empty
|
||||
ensure
|
||||
Logster.store.ignore = original_logster_store_ignore
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user