Skip to content

Commit

Permalink
Remove host and port from http logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lindenmckenzie committed Mar 18, 2024
1 parent 8686604 commit 0e3f640
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions gunicorn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def json_record(
payload: dict[str, str | int | float] = super().json_record(
event, extra, record
)
colon_index = record.args["{host}i"].find(":")
port = record.args["{host}i"][colon_index + 1 :].strip()

payload["namespace"] = settings.NAMESPACE
payload["created_at"] = (
Expand All @@ -71,8 +69,6 @@ def json_record(
payload["http"] = {
"method": record.args["m"],
"scheme": record.args["H"],
"host": record.args["h"],
"port": port,
"path": record.args["U"],
"query": record.args["q"],
"status_code": record.args["s"],
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/gunicorn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def test_request_formatting(self):
'http': {
'method': 'GET',
'scheme': 'https',
'host': '127.0.0.1',
'port': '1234',
'path': '/path/to/resource',
'query': 'param=value',
'status_code': '200',
Expand All @@ -63,8 +61,6 @@ def test_request_formatting(self):
# Http logs
self.assertEqual(expected["http"]["method"], formatted_log["http"]["method"])
self.assertEqual(expected["http"]["scheme"], formatted_log["http"]["scheme"])
self.assertEqual(expected["http"]["host"], formatted_log["http"]["host"])
self.assertEqual(expected["http"]["port"], formatted_log["http"]["port"])
self.assertEqual(expected["http"]["path"], formatted_log["http"]["path"])
self.assertEqual(expected["http"]["query"], formatted_log["http"]["query"])
self.assertTrue(parsable_isoformat(time=formatted_log["http"]["started_at"]))
Expand Down

0 comments on commit 0e3f640

Please sign in to comment.