diff options
Diffstat (limited to 'postgresql-model.lua')
-rw-r--r-- | postgresql-model.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/postgresql-model.lua b/postgresql-model.lua index 8e6e4cd..8bfe047 100644 --- a/postgresql-model.lua +++ b/postgresql-model.lua @@ -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, ...) |