summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2015-08-03 15:57:06 +0000
committerTed Trask <ttrask01@yahoo.com>2015-08-03 15:57:06 +0000
commit294502ad752a57a50ec9826a090a6c19ab658bc2 (patch)
tree7ece87dfb26d438a0629ffe08e9f205fc8ffc3fc
parent036605385492459e562a88a979d76a5aa9d20945 (diff)
downloadacf-dnsmasq-294502ad752a57a50ec9826a090a6c19ab658bc2.tar.bz2
acf-dnsmasq-294502ad752a57a50ec9826a090a6c19ab658bc2.tar.xz
Modify logfile to get logging info from the config and use common view
-rw-r--r--dnsmasq-controller.lua4
l---------[-rw-r--r--]dnsmasq-logfile-html.lsp7
-rw-r--r--dnsmasq-model.lua20
3 files changed, 25 insertions, 6 deletions
diff --git a/dnsmasq-controller.lua b/dnsmasq-controller.lua
index 22fe912..c20cab0 100644
--- a/dnsmasq-controller.lua
+++ b/dnsmasq-controller.lua
@@ -22,4 +22,8 @@ function mymodule.viewleases(self)
return self.model.getleases()
end
+function mymodule.logfile(self)
+ return self.model.get_logfile(self, self.clientdata)
+end
+
return mymodule
diff --git a/dnsmasq-logfile-html.lsp b/dnsmasq-logfile-html.lsp
index 771b9cd..ac8854f 100644..120000
--- a/dnsmasq-logfile-html.lsp
+++ b/dnsmasq-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="dnsmasq"})
-end %>
+../logfile-html.lsp \ No newline at end of file
diff --git a/dnsmasq-model.lua b/dnsmasq-model.lua
index c6e4ddd..287947d 100644
--- a/dnsmasq-model.lua
+++ b/dnsmasq-model.lua
@@ -344,4 +344,24 @@ function mymodule.getleases()
return modelfunctions.getfiledetails(leasefile)
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="dnsmasq", label="Grep" })
+
+ local conf = parse_file(fs.read_file(configfile) or "") or {}
+ if conf["log-facility"] then
+ local facility = conf["log-facility"][1]
+ if string.find(facility, "/") then
+ retval.value.filename = cfe({value=facility, label="File name"})
+ retval.value.facility = nil
+ retval.value.grep = nil
+ elseif not string.find(facility, "^%-$") then
+ retval.value.facility.value = string.lower(facility)
+ end
+ end
+
+ return retval
+end
+
return mymodule