Commit 3a3ff645 authored by Ted Trask's avatar Ted Trask

Added capability to read logfiles from config.

parent fe73a151
......@@ -18,4 +18,8 @@ function mymodule.expert(self)
return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Dovecot Config", "Configuration Set")
end
function mymodule.logfile(self)
return self.model.get_logfile()
end
return mymodule
......@@ -2,5 +2,7 @@
%>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename="/var/log/messages", grep="dovecot"})
for i,logfile in ipairs(data.value) do
viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename=logfile.path, grep=logfile.grep})
end
end %>
......@@ -10,7 +10,7 @@ local configfile = "/etc/dovecot/dovecot.conf"
local processname = "dovecot"
local packagename = "dovecot"
local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin "
local config
-- ################################################################################
-- LOCAL FUNCTIONS
......@@ -42,4 +42,22 @@ function mymodule.update_filedetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
function mymodule.get_logfile(f)
config = config or format.parse_ini_file(fs.read_file(configfile) or "", "")
local files = {}
if config and config.log_path then
files[#files+1] = {path = config.log_path}
end
if config and config.info_log_path then
files[#files+1] = {path = config.info_log_path}
end
if config and config.log_path then
files[#files+1] = {path = config.debug_log_path}
end
if 0 == #files then
files[#files+1] = {path = "/var/log/messages", grep = "dovecot"}
end
return cfe({ value=files, label="DoveCot Log Files" })
end
return mymodule
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