From 27c58808249d14a89dc336294d846ded95b3d262 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sat, 31 Oct 2015 19:21:40 +0000 Subject: Modify logfile to get logging info from the config and use common view --- postfix-controller.lua | 4 ++++ postfix-logfile-html.lsp | 7 +------ postfix-model.lua | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) mode change 100644 => 120000 postfix-logfile-html.lsp diff --git a/postfix-controller.lua b/postfix-controller.lua index 30dc8c9..b96faed 100644 --- a/postfix-controller.lua +++ b/postfix-controller.lua @@ -42,4 +42,8 @@ function mymodule.flushqueue(self) return self.handle_form(self, self.model.getflushqueue, self.model.flushqueue, self.clientdata, "Flush", "Flush Queue") end +function mymodule.logfile(self) + return self.model.get_logfile(self, self.clientdata) +end + return mymodule diff --git a/postfix-logfile-html.lsp b/postfix-logfile-html.lsp deleted file mode 100644 index e67975c..0000000 --- a/postfix-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="postfix"}) -end %> diff --git a/postfix-logfile-html.lsp b/postfix-logfile-html.lsp new file mode 120000 index 0000000..ac8854f --- /dev/null +++ b/postfix-logfile-html.lsp @@ -0,0 +1 @@ +../logfile-html.lsp \ No newline at end of file diff --git a/postfix-model.lua b/postfix-model.lua index 1c71401..8708263 100644 --- a/postfix-model.lua +++ b/postfix-model.lua @@ -193,4 +193,20 @@ function mymodule.flushqueue(self, flush) return flush end +function mymodule.get_logfile(self, clientdata) + local retval = cfe({ type="group", value={}, label="Log File Configuration" }) + retval.value.facility = cfe({value="mail", label="Syslog Facility"}) + retval.value.grep = cfe({ value="postfix", label="Grep" }) + + local config = getconfig() + if config["syslog_facility"] then + retval.value.facility.value = string.lower(config["syslog_facility"]) + end + if config["syslog_name"] then + retval.value.grep.value = config["syslog_name"] + end + + return retval +end + return mymodule -- cgit v1.2.3