Suppress health check request logs

/health gets hit constantly by k8s probes, drowning out useful logs.
This commit is contained in:
Graham McIntire 2026-04-06 11:55:00 -05:00
parent 88783765f1
commit 9ffeba3fc9
2 changed files with 6 additions and 2 deletions

View file

@ -46,7 +46,7 @@ defmodule MicrowavepropWeb.Endpoint do
plug Plug.RequestId
plug MicrowavepropWeb.Plugs.RemoteIp
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint], log: {__MODULE__, :log_level, []}
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
@ -57,4 +57,8 @@ defmodule MicrowavepropWeb.Endpoint do
plug Plug.Head
plug Plug.Session, @session_options
plug MicrowavepropWeb.Router
@doc false
def log_level(%{path_info: ["health"]}), do: false
def log_level(_conn), do: :info
end

View file

@ -23,7 +23,7 @@ defmodule MicrowavepropWeb.Router do
end
# Health check — no pipeline, minimal overhead
get "/health", MicrowavepropWeb.HealthController, :check
get "/health", MicrowavepropWeb.HealthController, :check, log: false
scope "/", MicrowavepropWeb do
pipe_through :browser