This commit is contained in:
dami
2026-07-05 15:28:56 +08:00
parent b47d1262ac
commit 90777e08ff
3 changed files with 6 additions and 2 deletions
+1
View File
@@ -7,6 +7,7 @@ PRAGMA journal_size_limit = 1073741824;
CREATE TABLE IF NOT EXISTS `web_logs` (
`time` INTEGER,
`ip` TEXT,
`scheme` TEXT,
`domain` TEXT,
`server_name` TEXT,
`method` TEXT,
+3 -2
View File
@@ -542,9 +542,9 @@ function _M.cron(self)
local stmt_ok, stmt = pcall(function()
return db:prepare[[INSERT INTO web_logs(
time, ip, domain, server_name, method, status_code, uri, body_length,
time, ip, scheme, domain, server_name, method, status_code, uri, body_length,
referer, user_agent, protocol, request_time, is_spider, request_headers, ip_list, client_port)
VALUES(:time, :ip, :domain, :server_name, :method, :status_code, :uri,
VALUES(:time, :ip, :scheme, :domain, :server_name, :method, :status_code, :uri,
:body_length, :referer, :user_agent, :protocol, :request_time, :is_spider,
:request_headers, :ip_list, :client_port)]]
end)
@@ -779,6 +779,7 @@ function _M.store_logs_line(self, db, stmt, input_sn, info)
stmt:bind_names {
time = logline["time"],
ip = logline["ip"],
scheme = logline["scheme"],
domain = logline["domain"],
server_name = logline["server_name"],
method = logline["method"],
+2
View File
@@ -200,12 +200,14 @@ local function run_app()
local request_uri = ngx.var.request_uri
local body_length = C:get_length()
local domain = host or "unknown"
local http_protocol = ngx.var.scheme or "http"
local kv = {
id = new_id,
time_key = os.date("%Y%m%d%H", ngx.time()),
time = ngx.time(),
ip = ip,
scheme = http_protocol,
domain = domain,
server_name = input_sn,
real_server_name = input_sn,