diff options
author | Ted Trask <ttrask01@yahoo.com> | 2010-05-03 07:00:32 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2010-05-03 07:00:32 +0000 |
commit | 05d1ebe08c34ea4d5e688841b610578a2eb283ab (patch) | |
tree | bdcf1f6cc81ec3d4210fe1ceab86fb6e30eec68d | |
parent | fe1200991db9e5c42b5e0e841b5a0c15d044bac4 (diff) | |
download | acf-weblog-05d1ebe08c34ea4d5e688841b610578a2eb283ab.tar.bz2 acf-weblog-05d1ebe08c34ea4d5e688841b610578a2eb283ab.tar.xz |
Add some null checks
-rw-r--r-- | weblog-model.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/weblog-model.lua b/weblog-model.lua index de837a5..dc9591b 100644 --- a/weblog-model.lua +++ b/weblog-model.lua @@ -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 |