gzip_ratio not printing in nginx logsHelp needed setting up nginx to serve static filesIIS7 is gzipping files...
Can a German sentence have two subjects?
TGV timetables / schedules?
Why don't electron-positron collisions release infinite energy?
Draw simple lines in Inkscape
What is the offset in a seaplane's hull?
Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)
Simulate Bitwise Cyclic Tag
Why Is Death Allowed In the Matrix?
DOS, create pipe for stdin/stdout of command.com(or 4dos.com) in C or Batch?
"You are your self first supporter", a more proper way to say it
How long does it take to type this?
The use of multiple foreign keys on same column in SQL Server
Patience, young "Padovan"
Japan - Plan around max visa duration
Chess with symmetric move-square
Shell script can be run only with sh command
declaring a variable twice in IIFE
N.B. ligature in Latex
Extreme, but not acceptable situation and I can't start the work tomorrow morning
What makes Graph invariants so useful/important?
How to make payment on the internet without leaving a money trail?
How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)
How does one intimidate enemies without having the capacity for violence?
Is there a familial term for apples and pears?
gzip_ratio not printing in nginx logs
Help needed setting up nginx to serve static filesIIS7 is gzipping files but not serving the gzipped versionTrouble with nginx and serving from multiple directories under the same domainConfigure php5-fpm for many concurrent usersNginx gives 504 Gateway Time-out once moved to liveApache / Nginx / Varnish - GZIP does not work on css, jsChange Nginx document root from /usr/share/nginx to /etc/nginxnginx configuration troubleUniversal HTTPS to HTTP reverse proxy using nginxWhy the .css and .js files of my website aren't compressed
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm configuring the nginx
access_log
to output in JSON
format to use with other tools.
The data I want includes info about the compression. I have gzip on, but the only thing I'm getting for the gzip_ratio
is -
.
To confirm, the embedded var is $gzip_ratio
.
http://nginx.org/en/docs/http/ngx_http_gzip_module.html
Here's the definition of my log_format
:
log_format main_json '{"time": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"body_bytes_sent": "$body_bytes_sent", '
'"gzip_ratio": "$gzip_ratio", '
'"status": "$status", '
'"request": "$request_time", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_time": "$request_time", '
'"upstream_response_time": "$upstream_response_time"}';
Here are the gzip settings in nginx.conf
:
gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript text/javascript application/xml+rss text/json application/json;
And here is the output in the access_log
:
{
"time":"2015-02-03T14:26:26+00:00",
"remote_addr":"[IP]",
"body_bytes_sent":"574",
"gzip_ratio":"-",
"status":"200",
"request":"0.064",
"request_method":"GET",
"http_referrer":"-",
"http_user_agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2293.0 Safari/537.36",
"http_x_forwarded_for":"-",
"request_time":"0.064",
"upstream_response_time":"0.064"
}
So, it appears that things are not being compressed. However, I've run cURL
to test for compression, and here are the results:
[~]$ curl https://[URL] --silent --write-out "size_download=%{size_download}n" --output /dev/null
size_download=3297
[~]$ curl https://[URL] --silent -H "Accept-Encoding: gzip,deflate" --write-out "size_download=%{size_download}n" --output /dev/null
size_download=859
So, from actually measuring the size of the response, it seems it is being compressed. However, the logs are still missing the gzip_ratio
. The body_bytes_sent
in each request's log matches up to the bytes reported by cURL
(slight variation w/ compressed response).
{"time": "2015-02-03T14:57:11+00:00", "remote_addr": "[IP]", "body_bytes_sent": "3297", "gzip_ratio": "-", "status": "200", "request": "0.477", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.477", "upstream_response_time": "0.477"}
{"time": "2015-02-03T14:57:20+00:00", "remote_addr": "[IP]", "body_bytes_sent": "871", "gzip_ratio": "-", "status": "200", "request": "0.676", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.676", "upstream_response_time": "0.676"}
Anyone know how I can get the actual gzip_ratio
?
nginx web-server gzip logging
add a comment |
I'm configuring the nginx
access_log
to output in JSON
format to use with other tools.
The data I want includes info about the compression. I have gzip on, but the only thing I'm getting for the gzip_ratio
is -
.
To confirm, the embedded var is $gzip_ratio
.
http://nginx.org/en/docs/http/ngx_http_gzip_module.html
Here's the definition of my log_format
:
log_format main_json '{"time": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"body_bytes_sent": "$body_bytes_sent", '
'"gzip_ratio": "$gzip_ratio", '
'"status": "$status", '
'"request": "$request_time", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_time": "$request_time", '
'"upstream_response_time": "$upstream_response_time"}';
Here are the gzip settings in nginx.conf
:
gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript text/javascript application/xml+rss text/json application/json;
And here is the output in the access_log
:
{
"time":"2015-02-03T14:26:26+00:00",
"remote_addr":"[IP]",
"body_bytes_sent":"574",
"gzip_ratio":"-",
"status":"200",
"request":"0.064",
"request_method":"GET",
"http_referrer":"-",
"http_user_agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2293.0 Safari/537.36",
"http_x_forwarded_for":"-",
"request_time":"0.064",
"upstream_response_time":"0.064"
}
So, it appears that things are not being compressed. However, I've run cURL
to test for compression, and here are the results:
[~]$ curl https://[URL] --silent --write-out "size_download=%{size_download}n" --output /dev/null
size_download=3297
[~]$ curl https://[URL] --silent -H "Accept-Encoding: gzip,deflate" --write-out "size_download=%{size_download}n" --output /dev/null
size_download=859
So, from actually measuring the size of the response, it seems it is being compressed. However, the logs are still missing the gzip_ratio
. The body_bytes_sent
in each request's log matches up to the bytes reported by cURL
(slight variation w/ compressed response).
{"time": "2015-02-03T14:57:11+00:00", "remote_addr": "[IP]", "body_bytes_sent": "3297", "gzip_ratio": "-", "status": "200", "request": "0.477", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.477", "upstream_response_time": "0.477"}
{"time": "2015-02-03T14:57:20+00:00", "remote_addr": "[IP]", "body_bytes_sent": "871", "gzip_ratio": "-", "status": "200", "request": "0.676", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.676", "upstream_response_time": "0.676"}
Anyone know how I can get the actual gzip_ratio
?
nginx web-server gzip logging
add a comment |
I'm configuring the nginx
access_log
to output in JSON
format to use with other tools.
The data I want includes info about the compression. I have gzip on, but the only thing I'm getting for the gzip_ratio
is -
.
To confirm, the embedded var is $gzip_ratio
.
http://nginx.org/en/docs/http/ngx_http_gzip_module.html
Here's the definition of my log_format
:
log_format main_json '{"time": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"body_bytes_sent": "$body_bytes_sent", '
'"gzip_ratio": "$gzip_ratio", '
'"status": "$status", '
'"request": "$request_time", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_time": "$request_time", '
'"upstream_response_time": "$upstream_response_time"}';
Here are the gzip settings in nginx.conf
:
gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript text/javascript application/xml+rss text/json application/json;
And here is the output in the access_log
:
{
"time":"2015-02-03T14:26:26+00:00",
"remote_addr":"[IP]",
"body_bytes_sent":"574",
"gzip_ratio":"-",
"status":"200",
"request":"0.064",
"request_method":"GET",
"http_referrer":"-",
"http_user_agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2293.0 Safari/537.36",
"http_x_forwarded_for":"-",
"request_time":"0.064",
"upstream_response_time":"0.064"
}
So, it appears that things are not being compressed. However, I've run cURL
to test for compression, and here are the results:
[~]$ curl https://[URL] --silent --write-out "size_download=%{size_download}n" --output /dev/null
size_download=3297
[~]$ curl https://[URL] --silent -H "Accept-Encoding: gzip,deflate" --write-out "size_download=%{size_download}n" --output /dev/null
size_download=859
So, from actually measuring the size of the response, it seems it is being compressed. However, the logs are still missing the gzip_ratio
. The body_bytes_sent
in each request's log matches up to the bytes reported by cURL
(slight variation w/ compressed response).
{"time": "2015-02-03T14:57:11+00:00", "remote_addr": "[IP]", "body_bytes_sent": "3297", "gzip_ratio": "-", "status": "200", "request": "0.477", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.477", "upstream_response_time": "0.477"}
{"time": "2015-02-03T14:57:20+00:00", "remote_addr": "[IP]", "body_bytes_sent": "871", "gzip_ratio": "-", "status": "200", "request": "0.676", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.676", "upstream_response_time": "0.676"}
Anyone know how I can get the actual gzip_ratio
?
nginx web-server gzip logging
I'm configuring the nginx
access_log
to output in JSON
format to use with other tools.
The data I want includes info about the compression. I have gzip on, but the only thing I'm getting for the gzip_ratio
is -
.
To confirm, the embedded var is $gzip_ratio
.
http://nginx.org/en/docs/http/ngx_http_gzip_module.html
Here's the definition of my log_format
:
log_format main_json '{"time": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"body_bytes_sent": "$body_bytes_sent", '
'"gzip_ratio": "$gzip_ratio", '
'"status": "$status", '
'"request": "$request_time", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_time": "$request_time", '
'"upstream_response_time": "$upstream_response_time"}';
Here are the gzip settings in nginx.conf
:
gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript text/javascript application/xml+rss text/json application/json;
And here is the output in the access_log
:
{
"time":"2015-02-03T14:26:26+00:00",
"remote_addr":"[IP]",
"body_bytes_sent":"574",
"gzip_ratio":"-",
"status":"200",
"request":"0.064",
"request_method":"GET",
"http_referrer":"-",
"http_user_agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2293.0 Safari/537.36",
"http_x_forwarded_for":"-",
"request_time":"0.064",
"upstream_response_time":"0.064"
}
So, it appears that things are not being compressed. However, I've run cURL
to test for compression, and here are the results:
[~]$ curl https://[URL] --silent --write-out "size_download=%{size_download}n" --output /dev/null
size_download=3297
[~]$ curl https://[URL] --silent -H "Accept-Encoding: gzip,deflate" --write-out "size_download=%{size_download}n" --output /dev/null
size_download=859
So, from actually measuring the size of the response, it seems it is being compressed. However, the logs are still missing the gzip_ratio
. The body_bytes_sent
in each request's log matches up to the bytes reported by cURL
(slight variation w/ compressed response).
{"time": "2015-02-03T14:57:11+00:00", "remote_addr": "[IP]", "body_bytes_sent": "3297", "gzip_ratio": "-", "status": "200", "request": "0.477", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.477", "upstream_response_time": "0.477"}
{"time": "2015-02-03T14:57:20+00:00", "remote_addr": "[IP]", "body_bytes_sent": "871", "gzip_ratio": "-", "status": "200", "request": "0.676", "request_method": "GET", "http_referrer": "-", "http_user_agent": "curl/7.37.0", "http_x_forwarded_for": "-", "request_time": "0.676", "upstream_response_time": "0.676"}
Anyone know how I can get the actual gzip_ratio
?
nginx web-server gzip logging
nginx web-server gzip logging
edited Feb 3 '15 at 21:57
gotmikhail
asked Feb 3 '15 at 15:01
gotmikhailgotmikhail
1214
1214
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Either you are using a buggy version of nginx or your test method had some flaws. I have just confirmed that $gzip_ratio
in a log_format
definition works perfectly fine in nginx 1.9.1.
I have seen $gzip_ratio
to only equal -
when no compression was performed. In all other cases it held a numeric value.
That's the same link I referenced in my question, our settings are nearly identical, less text/json, and I put faith incurl
. All of that was included in the question.
– gotmikhail
Jun 8 '15 at 12:20
Sorry, I actually let some days pass between reading your question and writing my answer. I will removed these parts that you have already referred to. I also know that my answer ("you must have done something wrong") might not be the most helpful one, but I figured this is better than leaving this un-answered forever. I think the crucial insight here is that this is not an nginx bug which would need to be reported.
– Jan-Philip Gehrcke
Jun 8 '15 at 12:23
I noticed the detail I left out was the second log, which had a larger value inbody_bytes_sent
. So, looks like it was compressing, but there at least was a bug with the$gzip_ratio
field. I actually haven't checked this in quite a while, I found another solution, but will review thenginx
version and report back.
– gotmikhail
Jun 8 '15 at 12:30
add a comment |
Encountered the same recently.
$gzip_ratio
is only available if nginx does the compression itself.
It will NOT be available if it actually is the upstream server that does the compression in a reverse-proxy/load-balancer scenario; that would match all your symptoms (response is actually compressed when tested with cURL).
A way to log that scenario is to include $sent_http_content_encoding
and/or $upstream_http_content_encoding
in your logs; it will contain "gzip".
Also worth checking for gzip_min_length
and gzip_types
config options to make sure responses actually qualify for gzipping.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f664634%2fgzip-ratio-not-printing-in-nginx-logs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Either you are using a buggy version of nginx or your test method had some flaws. I have just confirmed that $gzip_ratio
in a log_format
definition works perfectly fine in nginx 1.9.1.
I have seen $gzip_ratio
to only equal -
when no compression was performed. In all other cases it held a numeric value.
That's the same link I referenced in my question, our settings are nearly identical, less text/json, and I put faith incurl
. All of that was included in the question.
– gotmikhail
Jun 8 '15 at 12:20
Sorry, I actually let some days pass between reading your question and writing my answer. I will removed these parts that you have already referred to. I also know that my answer ("you must have done something wrong") might not be the most helpful one, but I figured this is better than leaving this un-answered forever. I think the crucial insight here is that this is not an nginx bug which would need to be reported.
– Jan-Philip Gehrcke
Jun 8 '15 at 12:23
I noticed the detail I left out was the second log, which had a larger value inbody_bytes_sent
. So, looks like it was compressing, but there at least was a bug with the$gzip_ratio
field. I actually haven't checked this in quite a while, I found another solution, but will review thenginx
version and report back.
– gotmikhail
Jun 8 '15 at 12:30
add a comment |
Either you are using a buggy version of nginx or your test method had some flaws. I have just confirmed that $gzip_ratio
in a log_format
definition works perfectly fine in nginx 1.9.1.
I have seen $gzip_ratio
to only equal -
when no compression was performed. In all other cases it held a numeric value.
That's the same link I referenced in my question, our settings are nearly identical, less text/json, and I put faith incurl
. All of that was included in the question.
– gotmikhail
Jun 8 '15 at 12:20
Sorry, I actually let some days pass between reading your question and writing my answer. I will removed these parts that you have already referred to. I also know that my answer ("you must have done something wrong") might not be the most helpful one, but I figured this is better than leaving this un-answered forever. I think the crucial insight here is that this is not an nginx bug which would need to be reported.
– Jan-Philip Gehrcke
Jun 8 '15 at 12:23
I noticed the detail I left out was the second log, which had a larger value inbody_bytes_sent
. So, looks like it was compressing, but there at least was a bug with the$gzip_ratio
field. I actually haven't checked this in quite a while, I found another solution, but will review thenginx
version and report back.
– gotmikhail
Jun 8 '15 at 12:30
add a comment |
Either you are using a buggy version of nginx or your test method had some flaws. I have just confirmed that $gzip_ratio
in a log_format
definition works perfectly fine in nginx 1.9.1.
I have seen $gzip_ratio
to only equal -
when no compression was performed. In all other cases it held a numeric value.
Either you are using a buggy version of nginx or your test method had some flaws. I have just confirmed that $gzip_ratio
in a log_format
definition works perfectly fine in nginx 1.9.1.
I have seen $gzip_ratio
to only equal -
when no compression was performed. In all other cases it held a numeric value.
edited Jun 8 '15 at 12:23
answered Jun 8 '15 at 11:52
Jan-Philip GehrckeJan-Philip Gehrcke
22026
22026
That's the same link I referenced in my question, our settings are nearly identical, less text/json, and I put faith incurl
. All of that was included in the question.
– gotmikhail
Jun 8 '15 at 12:20
Sorry, I actually let some days pass between reading your question and writing my answer. I will removed these parts that you have already referred to. I also know that my answer ("you must have done something wrong") might not be the most helpful one, but I figured this is better than leaving this un-answered forever. I think the crucial insight here is that this is not an nginx bug which would need to be reported.
– Jan-Philip Gehrcke
Jun 8 '15 at 12:23
I noticed the detail I left out was the second log, which had a larger value inbody_bytes_sent
. So, looks like it was compressing, but there at least was a bug with the$gzip_ratio
field. I actually haven't checked this in quite a while, I found another solution, but will review thenginx
version and report back.
– gotmikhail
Jun 8 '15 at 12:30
add a comment |
That's the same link I referenced in my question, our settings are nearly identical, less text/json, and I put faith incurl
. All of that was included in the question.
– gotmikhail
Jun 8 '15 at 12:20
Sorry, I actually let some days pass between reading your question and writing my answer. I will removed these parts that you have already referred to. I also know that my answer ("you must have done something wrong") might not be the most helpful one, but I figured this is better than leaving this un-answered forever. I think the crucial insight here is that this is not an nginx bug which would need to be reported.
– Jan-Philip Gehrcke
Jun 8 '15 at 12:23
I noticed the detail I left out was the second log, which had a larger value inbody_bytes_sent
. So, looks like it was compressing, but there at least was a bug with the$gzip_ratio
field. I actually haven't checked this in quite a while, I found another solution, but will review thenginx
version and report back.
– gotmikhail
Jun 8 '15 at 12:30
That's the same link I referenced in my question, our settings are nearly identical, less text/json, and I put faith in
curl
. All of that was included in the question.– gotmikhail
Jun 8 '15 at 12:20
That's the same link I referenced in my question, our settings are nearly identical, less text/json, and I put faith in
curl
. All of that was included in the question.– gotmikhail
Jun 8 '15 at 12:20
Sorry, I actually let some days pass between reading your question and writing my answer. I will removed these parts that you have already referred to. I also know that my answer ("you must have done something wrong") might not be the most helpful one, but I figured this is better than leaving this un-answered forever. I think the crucial insight here is that this is not an nginx bug which would need to be reported.
– Jan-Philip Gehrcke
Jun 8 '15 at 12:23
Sorry, I actually let some days pass between reading your question and writing my answer. I will removed these parts that you have already referred to. I also know that my answer ("you must have done something wrong") might not be the most helpful one, but I figured this is better than leaving this un-answered forever. I think the crucial insight here is that this is not an nginx bug which would need to be reported.
– Jan-Philip Gehrcke
Jun 8 '15 at 12:23
I noticed the detail I left out was the second log, which had a larger value in
body_bytes_sent
. So, looks like it was compressing, but there at least was a bug with the $gzip_ratio
field. I actually haven't checked this in quite a while, I found another solution, but will review the nginx
version and report back.– gotmikhail
Jun 8 '15 at 12:30
I noticed the detail I left out was the second log, which had a larger value in
body_bytes_sent
. So, looks like it was compressing, but there at least was a bug with the $gzip_ratio
field. I actually haven't checked this in quite a while, I found another solution, but will review the nginx
version and report back.– gotmikhail
Jun 8 '15 at 12:30
add a comment |
Encountered the same recently.
$gzip_ratio
is only available if nginx does the compression itself.
It will NOT be available if it actually is the upstream server that does the compression in a reverse-proxy/load-balancer scenario; that would match all your symptoms (response is actually compressed when tested with cURL).
A way to log that scenario is to include $sent_http_content_encoding
and/or $upstream_http_content_encoding
in your logs; it will contain "gzip".
Also worth checking for gzip_min_length
and gzip_types
config options to make sure responses actually qualify for gzipping.
add a comment |
Encountered the same recently.
$gzip_ratio
is only available if nginx does the compression itself.
It will NOT be available if it actually is the upstream server that does the compression in a reverse-proxy/load-balancer scenario; that would match all your symptoms (response is actually compressed when tested with cURL).
A way to log that scenario is to include $sent_http_content_encoding
and/or $upstream_http_content_encoding
in your logs; it will contain "gzip".
Also worth checking for gzip_min_length
and gzip_types
config options to make sure responses actually qualify for gzipping.
add a comment |
Encountered the same recently.
$gzip_ratio
is only available if nginx does the compression itself.
It will NOT be available if it actually is the upstream server that does the compression in a reverse-proxy/load-balancer scenario; that would match all your symptoms (response is actually compressed when tested with cURL).
A way to log that scenario is to include $sent_http_content_encoding
and/or $upstream_http_content_encoding
in your logs; it will contain "gzip".
Also worth checking for gzip_min_length
and gzip_types
config options to make sure responses actually qualify for gzipping.
Encountered the same recently.
$gzip_ratio
is only available if nginx does the compression itself.
It will NOT be available if it actually is the upstream server that does the compression in a reverse-proxy/load-balancer scenario; that would match all your symptoms (response is actually compressed when tested with cURL).
A way to log that scenario is to include $sent_http_content_encoding
and/or $upstream_http_content_encoding
in your logs; it will contain "gzip".
Also worth checking for gzip_min_length
and gzip_types
config options to make sure responses actually qualify for gzipping.
answered 11 mins ago
Ricardo PardiniRicardo Pardini
59649
59649
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f664634%2fgzip-ratio-not-printing-in-nginx-logs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown