Skip to content

Commit

Permalink
Log error messages as error_message instead of message
Browse files Browse the repository at this point in the history
Previously the library logged Rails error messages as "message" field, which would overwrite
the message field in Kibana. Log them as "error_message" instead to avoid confusion.
  • Loading branch information
theseanything authored and Tuomas Nylund committed Jul 13, 2023
1 parent e7f3e52 commit 6520134
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 9.0.3

* When error is reported by Rails logger, the field is now logged as "error_message" in order to avoid overwriting the "message" field.

# 9.0.2

* GovukAppConfig no longer automatically initialises OpenTelemetry when running in `rails console`.
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_app_config/govuk_json_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def self.configure
# Elasticsearch index expect error to be an object and logstash defaults
# error to be a string causing logs to be dropped.
Rails.application.config.logstasher.field_renaming = {
error: :message,
error: :error_message,
}

Rails.application.config.logstasher.logger = Logger.new(
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_app_config/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module GovukAppConfig
VERSION = "9.0.2".freeze
VERSION = "9.0.3".freeze
end

0 comments on commit 6520134

Please sign in to comment.