diff options
Diffstat (limited to 'dnsmasq-model.lua')
-rw-r--r-- | dnsmasq-model.lua | 20 |
1 files changed, 20 insertions, 0 deletions
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 |