Want to count a certain interface such as flash sales based on nginx logsMaximum number of concurrencies
The nginx log format is configured like this
log_format: $remote_addr [$time_local] "$request" $status $upstream_response_time $body_bytes_sent
Nginx official documentation defines time_local
like this
$time_local
local time in the Common Log Format
Now I am not sure whether this is the time when the request comes in or the time when this log is recorded after the request is processed. Only the former can count the maximum number of concurrency based on this time
擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級(jí)軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...
摘自:http://serverfault.com/questi...
The $local_time variable contains the time when the log entry is written.
when the HTTP request header is read, nginx does a lookup of the associated virtual server configuration. If the virtual server is found, the request goes through six phases:
server rewrite phase
location phase
location rewrite phase (which can bring the request back to the previous phase)
access control phase
try_files phase
log phase
Since the log phase is the last one, $local_time variable is much more colse to the end of the request than it's start.