Skip to content

Commit

Permalink
chore: filter healthchecks out of gunicorn logs (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardzilincikPantheon authored Jul 10, 2023
1 parent f688842 commit 58f4f2e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

bind = 'unix:/var/run/yang/yangvalidator.sock'
# umask = os.umask('007')

Expand All @@ -19,3 +21,13 @@
# change log format
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
worker_class = 'gevent'


class HealthcheckFilter(logging.Filter):
def filter(self, record):
return record.getMessage().find('Amazon-Route53-Health-Check-Service') == -1


def on_starting(server):
server.log.access_log.addFilter(HealthcheckFilter())
server.log.error_log.addFilter(HealthcheckFilter())

0 comments on commit 58f4f2e

Please sign in to comment.