Commit ce67fd36 authored by Ted Trask's avatar Ted Trask

Bug fix for malformed squid log.

parent 8cdd9167
......@@ -181,7 +181,7 @@ end
local importsquidlog = function(entry, sourcename)
if entry then
local sql = string.format("INSERT INTO weblog VALUES ('%s', '%s', '%s', '%s', '%s', '%s')",
escape(sourcename), escape(entry.clientip), escape(entry.clientuserid:lower()),
escape(sourcename), escape(entry.clientip), escape(entry.clientuserid):lower(),
escape(entry.logdatetime), escape(entry.URL), escape(entry.bytes))
local res = assert (con:execute(sql))
end
......@@ -562,14 +562,14 @@ local function parsesquidlog(line)
local logentry = {logdatetime=words[1],
elapsed=words[2],
clientip=words[3],
code=string.match(words[4], "^[^/]*"),
status=string.match(words[4], "[^/]*$"),
code=string.match(words[4] or "", "^[^/]*"),
status=string.match(words[4] or "", "[^/]*$"),
bytes=words[5],
method=words[6],
URL=words[7],
clientuserid=words[8],
peerstatus=string.match(words[9], "^[^/]*"),
peerhost=string.match(words[9], "[^/]*$")}
peerstatus=string.match(words[9] or "", "^[^/]*"),
peerhost=string.match(words[9] or "", "[^/]*$")}
logentry.logdatetime = os.date("%Y-%m-%d %H:%M:%S", logentry.logdatetime)..string.match(logentry.logdatetime, "%..*")
-- Don't care about local requests (from DG)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment