Skip to content

Commit

Permalink
Fix dropped logs due to incorrect error field type
Browse files Browse the repository at this point in the history
Kibana validates log lines by index patterns and "error" is supposed to be an object. Since error is a string in logstaher's world we are renaming it to "message" which will be accepted as string.

Co-authored-by: Neamah Al-Selwi <neamah.alselwi@digital.cabinet-office.gov.uk>
Co-authored-by: Tuomas Nylund <tuomas.nylund@digital.cabinet-office.gov.uk>
Co-authored-by: Laura Ghiorghisor <laura.ghiorghisor@digital.cabinet-office.gov.uk>
  • Loading branch information
4 people committed Jul 5, 2023
1 parent fb46270 commit 990244e
Showing 1 changed file with 5 additions and 0 deletions.
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

0 comments on commit 990244e

Please sign in to comment.