summaryrefslogtreecommitdiffstats
path: root/chrony-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'chrony-model.lua')
-rw-r--r--chrony-model.lua18
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