From 0c3e15063708f6218288ee5a30de090900655e0f Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 16 Sep 2009 11:44:13 +0000 Subject: Fixed bug with score, bumped version to 0.4.1 Bug caused an exception when there was a ':' but no score in the block reason. --- weblog-model.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'weblog-model.lua') diff --git a/weblog-model.lua b/weblog-model.lua index 1d67739..6ebc766 100644 --- a/weblog-model.lua +++ b/weblog-model.lua @@ -548,7 +548,7 @@ local parsedglog = function(logdata) 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.shortreason == "" then logentry.shortreason = logentry.reason end - logentry.score = string.match(logentry.reason, "^.*: ([0-9]*) ") + logentry.score = string.match(logentry.reason, "^.*: ([0-9]+) ") logentry.logdatetime = string.gsub(logentry.logdatetime, "%.", "-") logentries[#logentries+1] = logentry -- cgit v1.2.3 From 9fe058d4b6aaedf085b72322b4d54b48fb6d5df5 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 16 Sep 2009 13:40:35 +0000 Subject: Added support for .gz log files, bumped to 0.4.2 --- weblog-model.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'weblog-model.lua') diff --git a/weblog-model.lua b/weblog-model.lua index 6ebc766..ec4929e 100644 --- a/weblog-model.lua +++ b/weblog-model.lua @@ -604,11 +604,21 @@ local getlogfile = function(source, cookiesfile, logfile) local filecontent if source.method == "http" or source.method == "https" then local cmd = "wget -O - --no-check-certificate --load-cookies "..cookiesfile.." --post-data 'name="..logfile.."' '"..source.method.."://"..source.source.."/cgi-bin/acf/alpine-baselayout/logfiles/download' 2>/dev/null" + if string.find(logfile, "%.gz$") then + cmd = cmd.." | gunzip -c" + end local f = io.popen(cmd) filecontent = f:read("*a") f:close() elseif source.method == "local" then - filecontent = fs.read_file(logfile) + if string.find(logfile, "%.gz$") then + local cmd = "gunzip -c "..logfile + local f = io.popen(cmd) + filecontent = f:read("*a") + f:close() + else + filecontent = fs.read_file(logfile) + end end return filecontent end @@ -825,7 +835,7 @@ function importlogs() if connecttosource(source, cookiesfile) then local files = getlogcandidates(source, cookiesfile) for j,file in ipairs(files) do - if string.match(file, "dansguardian/access%.log%.") then + if string.match(file, "dansguardian/access%.log[%.%-]") then count = count + 1 logme("Processing " .. file ) logme("Getting " .. file ) @@ -834,7 +844,7 @@ function importlogs() importdglog(logentries, source.sourcename) logme("Deleting " .. file ) deletelogfile(source, cookiesfile, file) - elseif string.match(file, "squid/access%.log%.") then + elseif string.match(file, "squid/access%.log[%.%-]") then count = count + 1 logme("Processing " .. file ) logme("Getting " .. file ) -- cgit v1.2.3