feat(logging): add method + request_path to log metadata

Every Sent log line now carries method and path so noisy traffic
(probes, scrapers, redirects) is identifiable without a tracer.
RemoteIp plug already sets remote_ip metadata; add method and
request_path alongside it and register the extra keys with the
default formatter.
This commit is contained in:
Graham McIntire 2026-04-21 09:07:26 -05:00
parent cd2962687a
commit fbbb8b2e1e
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 7 additions and 2 deletions

View file

@ -30,7 +30,7 @@ config :live_table,
# Configure Elixir's Logger
config :logger, :default_formatter,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id, :remote_ip]
metadata: [:request_id, :remote_ip, :method, :request_path]
# Configure the mailer
#

View file

@ -37,7 +37,12 @@ defmodule MicrowavepropWeb.Plugs.RemoteIp do
conn
end
Logger.metadata(remote_ip: format_ip(conn.remote_ip))
Logger.metadata(
remote_ip: format_ip(conn.remote_ip),
method: conn.method,
request_path: conn.request_path
)
conn
end