Commit 05d1ebe0 authored by Ted Trask's avatar Ted Trask

Add some null checks

parent fe120099
......@@ -571,9 +571,9 @@ local function parsesquidlog(line)
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)
if logentry.clientip ~= "127.0.0.1" then
-- Don't care about local requests (from DG) (this check also removes blank lines)
if logentry.clientip and logentry.clientip ~= "127.0.0.1" then
logentry.logdatetime = os.date("%Y-%m-%d %H:%M:%S", logentry.logdatetime)..string.match(logentry.logdatetime, "%..*")
return logentry
end
return nil
......@@ -584,7 +584,7 @@ local function parsedglog(line)
local logentry = { logdatetime=words[1], clientuserid=words[2], clientip=words[3],
URL=words[4], reason=words[5], method=words[6], bytes=words[7],
shortreason=words[9]}
if logentry.reason ~= "" then
if logentry.reason and logentry.reason ~= "" then
if logentry.shortreason == "" then
logentry.shortreason = logentry.reason
end
......
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