Skip to content

Commit f7d15d8

Browse files
committed
Rename host logging field
Rename the "host" logging field to "request_host". An additional "host" field is added to the logs that go to Splunk for Kenesis. This means we end up with 2 values for "host" making it difficult to filter searches by it.
1 parent 375571d commit f7d15d8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def check_maintenance_mode_is_enabled
3737
end
3838

3939
def set_logging_attributes
40-
CurrentLoggingAttributes.host = request.host
40+
CurrentLoggingAttributes.request_host = request.host
4141
CurrentLoggingAttributes.request_id = request.request_id
4242
CurrentLoggingAttributes.session_id_hash = Digest::SHA256.hexdigest session.id.to_s if session.exists? && session.id.present?
4343
CurrentLoggingAttributes.trace_id = request.env["HTTP_X_AMZN_TRACE_ID"].presence

app/models/current_logging_attributes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class CurrentLoggingAttributes < ActiveSupport::CurrentAttributes
2-
attribute :host, :request_id, :session_id_hash, :trace_id, :user_ip,
2+
attribute :request_host, :request_id, :session_id_hash, :trace_id, :user_ip,
33
:user_id, :user_email, :user_organisation_slug, :acting_as_user_id,
44
:acting_as_user_email, :acting_as_user_organisation_slug, :form_id,
55
:page_id

spec/requests/application_controller_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
expect(log_lines[0]["request_id"]).to eq(request_id)
3535
end
3636

37-
it "includes the host on log lines" do
38-
expect(log_lines[0]["host"]).to eq("www.example.com")
37+
it "includes the request_host on log lines" do
38+
expect(log_lines[0]["request_host"]).to eq("www.example.com")
3939
end
4040

4141
it "includes the user_id on log lines" do

0 commit comments

Comments
 (0)