towerops/config/prod.exs
Graham McIntire 4ce1155548
fix: suppress noisy health check logs in production
Add logger filter to drop Kubernetes health probe logs that were flooding
production logs every few seconds.

Implementation:
- Create ToweropsWeb.TelemetryFilter module with filter_health_checks/2
- Configure as logger :default_handler filter in prod.exs
- Filters based on request_path metadata and message content
- Drops logs for GET /health and HEAD / requests

Impact:
- Eliminates ~120 log entries per minute per pod from K8s probes
- Keeps application logs focused on actual user activity and errors
- No impact on health check functionality - only suppresses logging

Files:
- lib/towerops_web/telemetry_filter.ex (new)
- lib/towerops/application.ex (attach filter on startup)
- config/prod.exs (add filter to logger config)
- CHANGELOG.txt
2026-03-05 13:13:19 -06:00

41 lines
1.2 KiB
Elixir

import Config
# Temporarily disable Honeybadger in production
config :honeybadger,
exclude_envs: [:prod]
# Filter out harmless Oban shutdown messages, repetitive SNMP MIB errors, and noisy health checks
config :logger, :default_handler,
filters: [
drop_oban_shutdown: {
&Towerops.LoggerFilters.drop_oban_shutdown/2,
[]
},
drop_snmp_mib_errors: {
&Towerops.LoggerFilters.drop_snmp_mib_errors/2,
[]
},
filter_health_checks: {
&ToweropsWeb.TelemetryFilter.filter_health_checks/2,
[]
}
]
# Do not print debug messages in production
config :logger,
level: :info,
metadata_filter: [oban_shutdown_filter: true]
# Configure Swoosh API Client
config :swoosh, api_client: Swoosh.ApiClient.Req
# Disable Swoosh Local Memory Storage
config :swoosh, local: false
# Note we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix assets.deploy` task,
# which you should run after static files are built and
# before starting your production server.
config :towerops, ToweropsWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
# SSL/TLS is handled by Cloudflared proxy - no force_ssl needed