Page 1 of 1

nginx start unknown log format "bytes"

Posted: Tue Feb 09, 2016 4:34 pm
by nmpribeiro
sudo service nginx start
Starting nginx: nginx: [emerg] unknown log format "bytes" in /home/admin/conf/web/nginx.conf:11
[FAILED]

On that file:
(...)
location / {
proxy_pass http://193.234.225.138:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|$
root /home/admin/web/domain.com/public_html;
access_log /var/log/httpd/domains/domain.com.log combined;
access_log /var/log/httpd/domains/domain.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
(...)

Clueless... I'll try to update vesta with the script.

Re: nginx start unknown log format "bytes"

Posted: Tue Feb 09, 2016 6:57 pm
by nmpribeiro
after some talk with the guys at freenode #nginx channel, I got into this documentation about 'log formats':
http://nginx.org/en/docs/http/ngx_http_ ... ml#example

Code: Select all

log_format compression '$remote_addr - $remote_user [$time_local] '
                       '"$request" $status $bytes_sent '
                       '"$http_referer" "$http_user_agent" "$gzip_ratio"';

access_log /spool/logs/nginx-access.log compression buffer=32k;
Basically we're making an alias 'compression' that can then be issued as a directive like that:

Code: Select all

access_log /spool/logs/nginx-access.log compression buffer=32k;
Knowing that, I've edited '/etc/nginx/nginx.conf' and between line 'log_format main (...)' inside http {
and before 'access_log'; basically defining a new alias for a log_format, I inserted the following:

Code: Select all

log_format  bytes   '$body_bytes_sent';
as the code pattern from viewtopic.php?t=4816 seams to indicate.

Hope this helps anyone that doesn't have an understanding of nginx and get's stuck on this error.

Re: nginx start unknown log format "bytes"

Posted: Tue Feb 09, 2016 7:40 pm
by pandabb
Thanks for the information.

Re: nginx start unknown log format "bytes"

Posted: Wed Feb 10, 2016 7:47 am
by nmpribeiro
Basically, this means an update has packed the nginx.conf into nginx.conf.rpmsave (in my case) and written a new nginx.conf

Other problems might appear as well (in my case, I can't figure out how to make SSL's work heh)

Re: nginx start unknown log format "bytes"

Posted: Sat May 01, 2021 8:06 pm
by fredfontes
In my case they are pointing to the latest domain I have created on the pannel. Example: every domain are pointing to last_domain.com. If I suspend last_domain.com they will all point to last_last_domain.com...

I dont know what to do!!!

Re: nginx start unknown log format "bytes"

Posted: Wed Sep 29, 2021 6:13 pm
by inazeem
Does anyone figured this out. I am having the same issue. It is pointing to one site.