Reduce verbosity for "Failing suspected API request to not-running server"

- API requests to non-running servers are not uncommon when you cull
  servers and people leave tabs open and active. It returns with 503
  and logs all headers, which can take up half of our total log lines
- This avoids logging headers for all 502 and 503 return statuses.
  #2747 presented an alternative (more complex) implementation, but this
  turned out to be appropriate.
- Closes: #2747
This commit is contained in:
Richard Darst
2019-09-26 17:33:38 +03:00
parent 5b13f96162
commit 231d14e95d

View File

@@ -162,7 +162,7 @@ def log_request(handler):
location='',
)
msg = "{status} {method} {uri}{location} ({user}@{ip}) {request_time:.2f}ms"
if status >= 500 and status != 502:
if status >= 500 and status not in {502, 503}:
log_method(json.dumps(headers, indent=2))
elif status in {301, 302}:
# log redirect targets