diff options
author | Ted Trask <ttrask01@yahoo.com> | 2015-08-03 19:44:18 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2015-08-03 19:44:18 +0000 |
commit | b3f42b0b5de4786752151641ef2af37f5ce3feaf (patch) | |
tree | 7fec7a3ba0fcde72007aaddf767862d94db935c4 /chrony-model.lua | |
parent | 30cdc5684382c8fb634bdfb79dc02d9d3b13786b (diff) | |
download | acf-chrony-b3f42b0b5de4786752151641ef2af37f5ce3feaf.tar.bz2 acf-chrony-b3f42b0b5de4786752151641ef2af37f5ce3feaf.tar.xz |
Modify logfile to get logging info from the config and use common view
Diffstat (limited to 'chrony-model.lua')
-rw-r--r-- | chrony-model.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrony-model.lua b/chrony-model.lua index 8661e20..12f82f4 100644 --- a/chrony-model.lua +++ b/chrony-model.lua @@ -231,4 +231,22 @@ function mymodule.update_filedetails(self, filedetails) return modelfunctions.setfiledetails(self, filedetails, {configfile}) end +function mymodule.get_logfile(self, clientdata) + local retval = cfe({ type="structure", value={{facility="daemon", grep="chronyd"}}, label="Log File Configuration" }) + local logdir = "/var/log/chrony" + local config = format.parse_linesandwords(fs.read_file(configfile) or "", "[!;#%%]") + if config then + for i,entry in ipairs(config) do + if entry[1] == "logdir" then + logdir = entry[2] + end + end + end + -- Add in files in the logdir + for f in fs.find(nil, logdir) do + retval.value[#retval.value+1] = {filename=f} + end + return retval +end + return mymodule |