Commit d8793e28 authored by Ted Trask's avatar Ted Trask

Made groupby work again

parent 570fb191
......@@ -884,7 +884,7 @@ local function importlogfile(source, cookiesfile, file, parselog_func)
end
pcall(function() logme("Exception on line:"..line) end)
if err2 then
pcall(function() logme("err2 "..err2) end)
pcall(function() logme(err2) end)
end
if (config.stoponerror == "true") then
assert(res2, "Import halted on exception")
......@@ -943,8 +943,7 @@ function importlogs()
if string.match(file, "dansguardian/access%.log[%.%-]") then
count = count + 1
success = importlogfile(source, cookiesfile, file, parsedglog) and success
end
if string.match(file, "squid/access%.log[%.%-]") then
elseif string.match(file, "squid/access%.log[%.%-]") then
count = count + 1
success = importlogfile(source, cookiesfile, file, parsesquidlog) and success
end
......@@ -1180,6 +1179,7 @@ function getconfig()
result.minimumscore = cfe({ value=config.minimumscore or "0", label="Minimum Score", descr="Minimum Score to search for", seq=5 })
result.window = cfe({ value=config.window or "5", label="Time Window", descr="Minutes of activity to display before and after selected block", seq=6 })
result.purgedays = cfe({ value=config.purgedays or "30", label="Days before Purge", descr="Days to keep history, regardless of audit", seq=10 })
result.groupby = cfe({ type="select", value=config.groupby or "clientuserid", label="Group results by", option={"clientuserid", "clientip"}, seq=7 })
result.shorturi = cfe({ type="boolean", value=(config.shorturi == "true"), label="Truncate URLs", descr="You can limit the length of displayed URLs by enabling this option", seq=7 })
result.shortreason = cfe({ type="boolean", value=(config.shortreason == "true"), label="Short Reason", descr="Display a short reason (dansguardian only)", seq=8 })
result.stoponerror = cfe({ type="boolean", value=(config.stoponerror == "true"), label="Stop on Error", descr="Stop import of logs if an error is encountered", seq=11})
......@@ -1187,7 +1187,8 @@ function getconfig()
end
local function validateconfig(newconfig)
local success = modelfunctions.validateselect(newconfig.value.sortby)
local success = modelfunctions.validateselect(newconfig.value.groupby)
success = modelfunctions.validateselect(newconfig.value.sortby) and success
if newconfig.value.window.value == "" then
newconfig.value.window.errtxt = "Cannot be blank"
success = false
......@@ -1227,7 +1228,7 @@ function updateconfig(newconfig)
configcontent = format.update_ini_file(configcontent, "", "auditend", newconfig.value.auditend.value)
configcontent = format.update_ini_file(configcontent, "", "window", newconfig.value.window.value)
configcontent = format.update_ini_file(configcontent, "", "purgedays", newconfig.value.purgedays.value)
--configcontent = format.update_ini_file(configcontent, "", "groupby", newconfig.value.groupby.value)
configcontent = format.update_ini_file(configcontent, "", "groupby", newconfig.value.groupby.value)
configcontent = format.update_ini_file(configcontent, "", "shorturi", tostring(newconfig.value.shorturi.value))
configcontent = format.update_ini_file(configcontent, "", "shortreason", tostring(newconfig.value.shortreason.value))
configcontent = format.update_ini_file(configcontent, "", "stoponerror", tostring(newconfig.value.stoponerror.value))
......
......@@ -5,7 +5,11 @@
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#audit").tablesorter({headers: {1:{sorter:'digit'}, 2:{sorter:'digit'}}});
<% if data.value.groupby.value == "clientip" then %>
$("#audit").tablesorter({headers: {0:{sorter:'ipAddress'}}});
<% else %>
$("#audit").tablesorter();
<% end %>
});
</script>
......
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