0

我们正在使用 NGINX / apache 的访问日志计算客户的流量使用情况。现在我想到了一个大问题。

如果我这样做怎么办:

<?php
    file_get_contents( "http://www.speedtest.qsc.de/1GB.qsc" );
?>

调用本身将是一个只有几个字节/千字节的简单 GET,但假设我们有足够的 memory_limit 和 max_execution_time,脚本将下载一个 1GB 的文件。这根本不会被记录,对吧?

有什么方法可以跟踪我上面提到的东西吗?

提前致谢

4

1 回答 1

0

对于 apache,默认日志是

LogFormat "%h %l %u %t \"%r\" %>s %b"

%b 代表Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent

你可能会用那个

http://httpd.apache.org/docs/2.2/mod/mod_log_config.html

对于 nginx,它也是默认的

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

http://nginx.org/en/docs/http/ngx_http_log_module.html

于 2013-11-27T14:16:46.323 回答