Commit 8e14e610 authored by Ted Trask's avatar Ted Trask

Modify logfile to get logging info from the config and use common view

parent 30a0990f
......@@ -38,4 +38,8 @@ function mymodule.viewcert(self)
return self.handle_form(self, self.model.get_view_cert, self.model.view_cert, self.clientdata, "View", "View Certificate")
end
function mymodule.logfile(self)
return self.model.get_logfile(self, self.clientdata)
end
return mymodule
<% local data, viewlibrary = ...
%>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename="/var/log/messages", grep="racoon"})
end %>
../logfile-html.lsp
\ No newline at end of file
......@@ -8,6 +8,7 @@ format = require("acf.format")
validator = require("acf.validator")
-- Set variables
local confdfile = "/etc/conf.d/racoon"
local configfile = "/etc/racoon/racoon.conf"
local configfile2 = "/etc/ipsec.conf"
local processname = "racoon"
......@@ -271,4 +272,25 @@ mymodule.view_cert = function(self, viewcert)
return viewcert
end
function mymodule.get_logfile(self, clientdata)
-- Can override syslog with logfile specified in command-line options "-l logfile"
-- Otherwise, uses syslog with facility LOG_DAEMON
local retval = cfe({ type="group", value={}, label="Log File Configuration" })
retval.value.facility = cfe({value="daemon", label="Syslog Facility"})
retval.value.grep = cfe({ value="racoon", label="Grep" })
local opts = format.parse_ini_file(fs.read_file(confdfile), "", "RACOON_OPTS")
if opts then
-- remove quotes
local opts2 = string.match(opts, "\"(.*)\"")
local opts = " "..(opts2 or "")
local logfile = string.match(opts, "%s%-l%s+(%S+)")
if logfile then
retval.value.filename = cfe({value=logfile, label="File name"})
retval.value.facility = nil
retval.value.grep = nil
end
end
return retval
end
return mymodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment