diff options
author | Ted Trask <ttrask01@yahoo.com> | 2015-09-23 13:01:08 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2015-09-23 13:02:05 +0000 |
commit | e4878341b8e86e3f170b7880d1b7350efcdd7113 (patch) | |
tree | 4c3ffd80bb323efa9ddbde69a454edfb57f5bad2 | |
parent | 4f56f8c829a2562c85c7cc01b7fcd4b5e99187ad (diff) | |
download | acf-clamav-e4878341b8e86e3f170b7880d1b7350efcdd7113.tar.bz2 acf-clamav-e4878341b8e86e3f170b7880d1b7350efcdd7113.tar.xz |
Modify logfile to get logging info from the config and use common view
-rw-r--r-- | clamav-controller.lua | 2 | ||||
l---------[-rw-r--r--] | clamav-logfile-html.lsp | 9 | ||||
-rw-r--r-- | clamav-model.lua | 29 |
3 files changed, 19 insertions, 21 deletions
diff --git a/clamav-controller.lua b/clamav-controller.lua index ee54309..3755999 100644 --- a/clamav-controller.lua +++ b/clamav-controller.lua @@ -23,7 +23,7 @@ function mymodule.expert(self) end function mymodule.logfile(self) - return self.model.getlogfile() + return self.model.get_logfile(self, self.clientdata) end return mymodule diff --git a/clamav-logfile-html.lsp b/clamav-logfile-html.lsp index d718396..ac8854f 100644..120000 --- a/clamav-logfile-html.lsp +++ b/clamav-logfile-html.lsp @@ -1,8 +1 @@ -<% local data, viewlibrary = ... -%> - -<% if viewlibrary and viewlibrary.dispatch_component then - for i,logfile in ipairs(data.value) do - viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename=logfile.path, grep=logfile.grep}) - end -end %> +../logfile-html.lsp
\ No newline at end of file diff --git a/clamav-model.lua b/clamav-model.lua index c1e1d2a..f5c3240 100644 --- a/clamav-model.lua +++ b/clamav-model.lua @@ -55,21 +55,26 @@ function mymodule.updatefiledetails(self, filedetails) return modelfunctions.setfiledetails(self, filedetails, filelist) end -function mymodule.getlogfile () +function mymodule.get_logfile(self, clientdata) local files = {} - local logfilepath = format.parse_configfile(fs.read_file(filelist[1]) or "").LogFile - if not logfilepath then - files[#files+1] = {path = "/var/log/messages", grep = "clamd"} - else - files[#files+1] = {path=logfilepath} + local config = format.parse_configfile(fs.read_file(filelist[1]) or "") + local logfilepath = config.LogFile + if logfilepath then + files[#files+1] = {filename=logfilepath} end - logfilepath = format.parse_configfile(fs.read_file(filelist[2]) or "").UpdateLogFile - if not logfilepath then - files[#files+1] = {path = "/var/log/messages", grep = "freshclam"} - else - files[#files+1] = {path=logfilepath} + if config.LogSyslog then + files[#files+1] = {facility=config.LogFacility or "LOG_LOCAL6", grep="clamd"} end - return cfe({ value=files, label="ClamAV logfiles" }) + config = format.parse_configfile(fs.read_file(filelist[2]) or "") + logfilepath = config.UpdateLogFile + if logfilepath then + files[#files+1] = {filename=logfilepath} + end + if config.LogSyslog then + files[#files+1] = {facility=config.LogFacility or "LOG_LOCAL6", grep="freshclam"} + end + + return cfe({ type="structure", value=files, label="ClamAV logfiles" }) end return mymodule |