Commit 8addabae authored by Ted Trask's avatar Ted Trask

Modify logfile to get logging info from the config and use common view

parent 15f47364
......@@ -28,6 +28,10 @@ function mymodule.expert(self)
return self.handle_form(self, function() return self.model.getfiledetails(self.clientdata.filename) end, self.model.updatefiledetails, self.clientdata, "Save", "Edit Postgresql File", "File Saved")
end
function mymodule.logfile(self)
return self.model.get_logfile(self, self.clientdata)
end
-- Use acf-db to allow editing of the database
dbcontrollerfunctions = require("dbcontrollerfunctions")
for n,f in pairs(dbcontrollerfunctions) do
......
<% local data, viewlibrary = ...
%>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename="/var/log/messages", grep="postgres"})
end %>
../logfile-html.lsp
\ No newline at end of file
......@@ -105,6 +105,36 @@ function mymodule.updatefiledetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, determinefilelist())
end
function mymodule.get_logfile(self, clientdata)
local retval = cfe({ type="structure", value={}, label="Log File Configuration" })
if string.find(getconfvalue("log_destination") or "", "syslog") then
retval.value[#retval.value+1] = {facility=getconfvalue("syslog_facility") or "local0", grep=getconfvalue("syslog_ident") or "postgres"}
end
if getconfvalue("logging_collector") == "on" then
local logdir = getconfvalue("log_directory") or "pg_log"
if not string.find(logdir, "^/") then
logdir = datadirectory.."/"..logdir
end
local logfile = getconfvalue("log_filename") or "postgresql-"
-- drop the escapes
logfile = string.match(logfile, "^[^%%]*")
local files = fs.find_files_as_array(format.escapemagiccharacters(logfile)..".*", logdir)
for i,f in ipairs(files) do
retval.value[#retval.value+1] = {filename=f}
end
end
if #retval.value == 0 then
retval.value[#retval.value+1] = {facility="daemon", grep="postgres"}
end
retval.value[#retval.value+1] = {filename=datadirectory.."/postmaster.log"}
return retval
end
for n,f in pairs(dbmodelfunctions) do
mymodule[n] = function(...)
return f(determineconnection, ...)
......
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