From 0de33748d6b213e319fd21bd72732fa8a73be61d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sat, 31 Oct 2015 19:04:15 +0000 Subject: Modify logfile to use common view --- openntpd-controller.lua | 4 ++++ openntpd-logfile-html.lsp | 7 +------ openntpd-model.lua | 9 +++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) mode change 100644 => 120000 openntpd-logfile-html.lsp diff --git a/openntpd-controller.lua b/openntpd-controller.lua index e1b7ca3..9391df0 100644 --- a/openntpd-controller.lua +++ b/openntpd-controller.lua @@ -22,4 +22,8 @@ function mymodule.startstop(self) return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata) end +function mymodule.logfile(self) + return self.model.get_logfile(self, self.clientdata) +end + return mymodule diff --git a/openntpd-logfile-html.lsp b/openntpd-logfile-html.lsp deleted file mode 100644 index 57e315b..0000000 --- a/openntpd-logfile-html.lsp +++ /dev/null @@ -1,6 +0,0 @@ -<% local data, viewlibrary = ... -%> - -<% if viewlibrary and viewlibrary.dispatch_component then - viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename="/var/log/messages", grep="ntpd"}) -end %> diff --git a/openntpd-logfile-html.lsp b/openntpd-logfile-html.lsp new file mode 120000 index 0000000..ac8854f --- /dev/null +++ b/openntpd-logfile-html.lsp @@ -0,0 +1 @@ +../logfile-html.lsp \ No newline at end of file diff --git a/openntpd-model.lua b/openntpd-model.lua index f5607f5..5aec085 100644 --- a/openntpd-model.lua +++ b/openntpd-model.lua @@ -16,6 +16,8 @@ local processname = "ntpd" local function last_time_change() local cmdoutput = "(Have no data on updates)" + -- This works for busybox syslog, which always logs to /var/log/messages + -- FIXME to work with other syslog options local mess = fs.read_file_as_array("/var/log/messages") for i=table.maxn(mess),1,-1 do if string.find(mess[i], "ntpd.*adjusting") then @@ -162,4 +164,11 @@ function mymodule.update_filedetails(self, filedetails) return modelfunctions.setfiledetails(self, filedetails, {configfile}) end +function mymodule.get_logfile(self, clientdata) + local retval = cfe({ type="group", value={}, label="Log File Configuration" }) + retval.value.facility = cfe({value="daemon", label="Syslog Facility"}) + retval.value.grep = cfe({ value="ntpd", label="Grep" }) + return retval +end + return mymodule -- cgit v1.2.3