我怎样才能调整nginx写请求时间的日志,这样awstats可以显示每个请求的时间?
另外,如何在awstats中查看所需时间?
这是目前的格式
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
正如@Vladimir提到的那样,要logging请求时间,请按照以下方式编辑您的log_format指令:
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"' ' $request_time';
并在awstatsconfiguration文件中为LogFormat设置相应的variables:
LogFormat="%host %other %host_r %time1 %methodurl %code %bytesd %refererquot %uaquot %other %extra1"
以下是一个extra1节的例子:
ExtraSectionName1="Time to serve requests (seconds)" ExtraSectionCodeFilter1="" ExtraSectionFirstColumnTitle1="Number of seconds to serve the request" ExtraSectionFirstColumnValues1="extra1,(.*)" ExtraSectionStatTypes1="H"
build设报告:
awstats.pl -config=model -output -staticlinks > awstats.localhost.html

您可以使用$ request_timevariables,如下所示:
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent $request_time "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
编辑:哎呀,错过了你的第二个问题。 您可以使用带有extraNvariables的LogFormat指令来使AWStatsparsing新的格式,然后使用ExtraSection显示结果。