Forum: NGINX how can I fetch byte logs in nginx like "%{%s}t %I .\n%{%s}t %O ."

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C3ab146b8cf153e371e60a6f288f7188?d=identicon&s=25 Joe Shang (Guest)
on 2008-11-14 19:14
(Received via mailing list)
In Apache I fetch byte logs using:

CustomLog /usr/local/apache/logs/DOMAIN.COM-bytes_log "%{%s}t %I
.\n%{%s}t %O ."

Can I achieve the similar effect this does in Apache, in nginx ?

If so, can anyone give me the proper syntax to do so in nginx config?

Joe
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 mike (Guest)
on 2008-11-14 19:22
(Received via mailing list)
to save us lazy people some time can you define what each of these is?
C3ab146b8cf153e371e60a6f288f7188?d=identicon&s=25 Joe Shang (Guest)
on 2008-11-14 19:28
(Received via mailing list)
basically the outcome of the byte-log files would be:

1226686775 238 .
1226686776 527 .
1226686776 5270 .
1226686776 448 .
1226686776 5455 .
1226686777 391 .
1226686777 5274 .
1226686777 549 .
1226686777 196 .
1226686777 456 .
1226686777 197 .
1226686777 154 .
1226686777 5455 .
1226686896 66 .
1226686896 251 .
1226686896 284 .
1226686896 1949 .
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 mike (Guest)
on 2008-11-14 19:38
(Received via mailing list)
Timestamp and bytes?

log_format byteslog '$time_local $bytes_sent';

access_log /var/log/nginx/DOMAIN.COM-bytes_log byteslog;

$time_local is this syntax "14/Nov/2008:10:27:48 -0800"

I am not sure there is a timestamp variable. You could look at
$msec, the time with an accuracy to microseconds at the moment of the
log entry

This has some of the variables:
http://wiki.codemongers.com/NginxHttpLogModule

You can also use any of these:
$query_string
$request_method
$content_type
$content_length
$fastcgi_script_name
$request_uri
$document_uri
$document_root
$server_protocol
$remote_addr
$remote_port
$server_addr
$server_port
$http_host
$server_name

Not sure what other ones are out there too.
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-14 19:41
(Received via mailing list)
On Fri, Nov 14, 2008 at 12:22:31PM -0600, Joe Shang wrote:

> 1226686777 196 .
> 1226686777 456 .
> 1226686777 197 .
> 1226686777 154 .
> 1226686777 5455 .
> 1226686896 66 .
> 1226686896 251 .
> 1226686896 284 .
> 1226686896 1949 .

The near approximation is

log_format  bytes  "$msec - .\n$msec $bytes_sent .";

but time will be in 1226686777.123 form and there will be no "bytes
received".

BTW, how do you distinguish input lines from output ones in the log ?
94389c4cf2baaab5798bbc5e899ff0e9?d=identicon&s=25 Gena Makhomed (Guest)
on 2008-11-14 19:46
(Received via mailing list)
On Friday, November 14, 2008 at 19:58:56, Joe Shang wrote:

JS> In Apache I fetch byte logs using:
JS> CustomLog /usr/local/apache/logs/DOMAIN.COM-bytes_log "%{%s}t %I
.\n%{%s}t %O ."
JS> Can I achieve the similar effect this does in Apache, in nginx ?
JS> If so, can anyone give me the proper syntax to do so in nginx
config?

http://wiki.codemongers.com/NginxHttpLogModule
C3ab146b8cf153e371e60a6f288f7188?d=identicon&s=25 Joe Shang (Guest)
on 2008-11-14 22:08
(Received via mailing list)
I am trying to convert Apache to nginx in a box I have, but I want to
use the tools already this control panel uses, so I try to make sure
there is no interference , and smooth, if this is successful, this
would be very sweet.

There is no way to cut down the format so its in like 1226686777 form
? would there be future implementation for bytes received ?

Joe
F5a6ed477b109fe6acc11a5a8f87e7e8?d=identicon&s=25 mike (Guest)
on 2008-11-14 22:27
(Received via mailing list)
On Fri, Nov 14, 2008 at 12:59 PM, Joe Shang <joe.shang@gmail.com> wrote:

> There is no way to cut down the format so its in like 1226686777 form
> ? would there be future implementation for bytes received ?

This is one thing I wanted too - a way to capture -all- traffic. Large
file uploads add up.
This topic is locked and can not be replied to.