Access logs produce log upon closing of HTTP connection

79 views
Skip to first unread message

mat...@otainsight.com

unread,
Mar 4, 2019, 10:24:27 AM3/4/19
to meinheld
I have a django application running with gunicorn and meinheld. The problem I encounter is that after a request, each time a client closes the http connection, an access log for that is produced, with basically an empty content. I'd like to disable these logs.

This is a request done from curl:

```
Mathieus-MBP:~ mhindery$ curl localhost:9000/_ah/ready/ -vvv
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9000 (#0)
> GET /_ah/ready/ HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
< HTTP/1.1 200 OK
< Server: meinheld/0.6.1
< Date: Mon, 04 Mar 2019 15:18:21 GMT
< Content-Security-Policy-Report-Only: frame-ancestors 'none'; report-uri /_/csp_reports
< Content-Length: 2
< Expires: Mon, 04 Mar 2019 15:18:23 GMT
< Content-Type: text/html; charset=utf-8
< Cache-Control: no-cache, no-store, must-revalidate, max-age=0
< Connection: Keep-Alive
* Connection #0 to host localhost left intact
```

And this is the access logs I get:

```
127.0.0.1 - - [04/Mar/2019:15:15:32 +0000] "GET /_ah/ready/ HTTP/1.1" 200 2 "-" "curl/7.54.0"
127.0.0.1 - - [04/Mar/2019:15:15:32 +0000] "- - HTTP/1.0" 0 0 "-" "-"
127.0.0.1 - - [04/Mar/2019:15:15:37 +0000] "GET /_ah/ready/ HTTP/1.1" 200 2 "-" "curl/7.54.0"
127.0.0.1 - - [04/Mar/2019:15:15:37 +0000] "- - HTTP/1.0" 0 0 "-" "-"
127.0.0.1 - - [04/Mar/2019:15:18:23 +0000] "GET /_ah/ready/ HTTP/1.1" 200 2 "-" "curl/7.54.0"
127.0.0.1 - - [04/Mar/2019:15:18:23 +0000] "- - HTTP/1.0" 0 0 "-" "-"
```

Every request is thus accompanied by an extra log for the connection being closed. When I do multiple request in a short time with e.g. insomnia, the connection is reused according to the logs, and I only get a this empty log line at the end:

This is what insomnia gives me as timeline information, note that it says re-using existing connection, this is every subsequent request so:

```
* Preparing request to http://localhost:9000/_ah/health
* Using libcurl/7.54.0 LibreSSL/2.6.4 zlib/1.2.11 nghttp2/1.24.1
* Disable timeout
* Enable automatic URL encoding
* Disable SSL validation
* Enable cookie sending with jar of 4 cookies
* Found bundle for host localhost: 0x7ff423fd9150 [can pipeline]
* Re-using existing connection! (#31) with host localhost
* Connected to localhost (127.0.0.1) port 9000 (#31)

> GET /_ah/health HTTP/1.1
> Host: localhost:9000
> User-Agent: insomnia/6.3.2
> Cookie: csrftoken=u0ONALHN0zizw7HeScVBISpIBuyIYSZz1yB611MixzKAmMtQVHTQkWgKUR34JBix
> Accept: */*

< HTTP/1.1 200 OK
< Server: meinheld/0.6.1
< Date: Mon, 04 Mar 2019 15:20:08 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: Keep-Alive

* Received 7 B chunk
* Received 5 B chunk
* Connection #31 to host localhost left intact
```

The logs from gunicorn look like this, every subsequent request re-uses the connection and thus does not get the duplicate log, until the last one, which closes the connection after some time I guess?:

```
127.0.0.1 - - [04/Mar/2019:15:20:04 +0000] "GET /_ah/health HTTP/1.1" 200 2 "-" "insomnia/6.3.2"
127.0.0.1 - - [04/Mar/2019:15:20:05 +0000] "GET /_ah/health HTTP/1.1" 200 2 "-" "insomnia/6.3.2"
127.0.0.1 - - [04/Mar/2019:15:20:06 +0000] "GET /_ah/health HTTP/1.1" 200 2 "-" "insomnia/6.3.2"
127.0.0.1 - - [04/Mar/2019:15:20:06 +0000] "GET /_ah/health HTTP/1.1" 200 2 "-" "insomnia/6.3.2"
127.0.0.1 - - [04/Mar/2019:15:20:07 +0000] "GET /_ah/health HTTP/1.1" 200 2 "-" "insomnia/6.3.2"
127.0.0.1 - - [04/Mar/2019:15:20:08 +0000] "GET /_ah/health HTTP/1.1" 200 2 "-" "insomnia/6.3.2"
127.0.0.1 - - [04/Mar/2019:15:20:10 +0000] "- - HTTP/1.0" 0 0 "-" "-"
```

The gunicorn config is pretty straightforward:

```
bind = "0.0.0.0:9000"
workers = 4
accesslog = "-"  # stdout
errorlog = "-"  # stderr
loglevel = "warning"
worker_class = "egg:meinheld#gunicorn_worker"
graceful_timeout = 20
```

I can disable access_log entirely, but that's not what I want. Any way these logs can be disabled? They lead to a ton of extra log volume and don't offer us useful information.

Message has been deleted

Naveen Y

unread,
Feb 2, 2020, 8:52:54 AM2/2/20
to meinheld
Hey, I am facing the same issue, did you find any workaround for this?
Reply all
Reply to author
Forward
0 new messages