worker_processes auto;
events { worker_connections 1024; }
http {
default_type text/html;
log_escape_non_ascii off;
log_format mydef $logformat;
server {
listen 6699;
server_name localhost;
set $logpath "logs/access.log";
set $logformat "";
access_log $logpath mydef;
location / {
index index.html index.htm;
content_by_lua_block {
local x = {
'time\t $time_local',
'status\t$status',
'host\t$host',
'method\t$request_method',
'http_ver\t$server_protocol',
'uri\t$request_uri',
'bytes_sent\t$bytes_sent',
'request_length\t$request_length',
'\n'
}
local _str = table.concat(x, "\n")
ngx.var.logformat = _str
ngx.say(_str)
}
}
}
}