summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrony-controller.lua4
l---------[-rw-r--r--]chrony-logfile-html.lsp7
-rw-r--r--chrony-model.lua18
3 files changed, 23 insertions, 6 deletions
diff --git a/chrony-controller.lua b/chrony-controller.lua
index eedffb5..5fbd6d4 100644
--- a/chrony-controller.lua
+++ b/chrony-controller.lua
@@ -30,4 +30,8 @@ function mymodule.expert(self)
return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Config File", "Configuration Set")
end
+function mymodule.logfile(self)
+ return self.model.get_logfile(self, self.clientdata)
+end
+
return mymodule
diff --git a/chrony-logfile-html.lsp b/chrony-logfile-html.lsp
index a1184f8..ac8854f 100644..120000
--- a/chrony-logfile-html.lsp
+++ b/chrony-logfile-html.lsp
@@ -1,6 +1 @@
-<% local data, viewlibrary = ...
-%>
-
-<% if viewlibrary and viewlibrary.dispatch_component then
- viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename="/var/log/messages", grep="chronyd"})
-end %>
+../logfile-html.lsp \ No newline at end of file
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