diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-05-26 22:37:03 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-05-26 22:37:03 +0000 |
commit | 3a3ff6452f6a59a0af47587174ecd2bcfe9c1219 (patch) | |
tree | b3166dc0a82b4d6c4d01d2c0c45f0bc710236748 /dovecot-model.lua | |
parent | fe73a1516a76911e67dd43a702cacfefd0932c43 (diff) | |
download | acf-dovecot-3a3ff6452f6a59a0af47587174ecd2bcfe9c1219.tar.bz2 acf-dovecot-3a3ff6452f6a59a0af47587174ecd2bcfe9c1219.tar.xz |
Added capability to read logfiles from config.
Diffstat (limited to 'dovecot-model.lua')
-rw-r--r-- | dovecot-model.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/dovecot-model.lua b/dovecot-model.lua index 25393e0..74aff69 100644 --- a/dovecot-model.lua +++ b/dovecot-model.lua @@ -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 |