Skip to content

Commit

Permalink
Merge pull request #306 from alphagov/fix-dropped-error-logs
Browse files Browse the repository at this point in the history
Fix dropped logs due to incorrect error field type
  • Loading branch information
yuetylauiris authored Jul 5, 2023
2 parents fb46270 + 0524f39 commit 4fb9681
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 9.0.1

* Rename the "error" field in Rails logs from logstasher to "message" as error is supposed to be an object.

# 9.0.0

* BREAKING: JSON logs are no longer configured automatically for production Rails apps and are turned on with the GOVUK_RAILS_JSON_LOGGING environment variable ([#302](https://github.com/alphagov/govuk_app_config/pull/302))
Expand Down
5 changes: 5 additions & 0 deletions lib/govuk_app_config/govuk_json_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def self.configure
# Elasticsearch index expect source to be an object and logstash defaults
# source to be the host IP address causing logs to be dropped.
Rails.application.config.logstasher.source = {}
# 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,
}

Rails.application.config.logstasher.logger = Logger.new(
$stdout,
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.0".freeze
VERSION = "9.0.1".freeze
end

0 comments on commit 4fb9681

Please sign in to comment.