Commit 900e1950 authored by Mika Havela's avatar Mika Havela

Adding config option so user can choose to truncate urls in audit logs

parent e4eccf5f
......@@ -435,7 +435,11 @@ local listlogentries = function(logname, clientuserid, starttime, endtime, clien
cur = assert (con:execute(sql))
row = cur:fetch ({}, "a")
while row do
entries[#entries+1] = {sourcename=row.sourcename, clientip=row.clientip, clientuserid=row.clientuserid, logdatetime=row.logdatetime, uri=row.uri, bytes=row.bytes, reason=row.reason, score=row.score, shortreason=row.shortreason}
local uridescr = row.uri
if (config.shorturls == "true") then
uridescr=string.gsub(row.uri, "[;?].*", "...")
end
entries[#entries+1] = {sourcename=row.sourcename, clientip=row.clientip, clientuserid=row.clientuserid, logdatetime=row.logdatetime, uri=row.uri, uridescr=uridescr, bytes=row.bytes, reason=row.reason, score=row.score, shortreason=row.shortreason,debug=config.shorturls}
row = cur:fetch (row, "a")
end
-- close everything
......@@ -1170,6 +1174,7 @@ function getconfig()
result.purgedays = cfe({ value=config.purgedays or "30", label="Days before Purge", descr="Days to keep history, regardless of audit" })
result.historydays = cfe({ value=config.historydays or "14", label="Days to keep History", descr="Days beyond Audit Start Time to keep complete log history" })
result.groupby = cfe({ type="select", value=config.groupby or "clientuserid", label="Group results by", option={"clientuserid", "clientip"} })
result.shorturls = cfe({ type="select", value=config.shorturls or "false", label="Truncate URL's in audit log", option={"true","false"}, descr="You can limit the lenght of urls in your audit log by selecting 'true'"})
return cfe({ type="group", value=result, label="Weblog Config" })
end
......@@ -1225,6 +1230,7 @@ function updateconfig(newconfig)
configcontent = format.update_ini_file(configcontent, "", "purgedays", newconfig.value.purgedays.value)
configcontent = format.update_ini_file(configcontent, "", "historydays", newconfig.value.historydays.value)
configcontent = format.update_ini_file(configcontent, "", "groupby", newconfig.value.groupby.value)
configcontent = format.update_ini_file(configcontent, "", "shorturls", newconfig.value.shorturls.value)
fs.write_file(configfile, configcontent)
config = format.parse_ini_file(configcontent, "") or {}
......
......@@ -91,7 +91,7 @@ end
<TD <% if data.value.clientuserid.value == watch.clientuserid then %> style="font-weight:bold;" <% end %> ><%= html.html_escape(watch.clientuserid) %></TD>
<TD><%= html.html_escape(watch.bytes) %></TD>
<TD title="<%= html.html_escape(watch.uri) %>" >
<%= html.link{value = watch.uri, label=watch.uri} %></TD>
<%= html.link{value = watch.uri, label=watch.uridescr or watch.uri} %></TD>
</TR>
<TR <%= mark %>>
<TD class='reason' <% if (watch.shortreason and watch.shortreason ~= "") or (watch.reason and watch.reason ~= "") then %>
......
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