summaryrefslogtreecommitdiffstats
path: root/weblog-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'weblog-model.lua')
-rw-r--r--weblog-model.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/weblog-model.lua b/weblog-model.lua
index d29c096..460a8f5 100644
--- a/weblog-model.lua
+++ b/weblog-model.lua
@@ -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)