From a6f16048944ab1fccdd4b7ca099cc401c90cd81e Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 31 Jul 2015 16:49:22 +0000 Subject: First cut at logfile-html.lsp view, only works with busybox syslog --- app/Makefile | 1 + app/logfile-html.lsp | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 app/logfile-html.lsp diff --git a/app/Makefile b/app/Makefile index 93b8eb8..2b93f30 100644 --- a/app/Makefile +++ b/app/Makefile @@ -33,6 +33,7 @@ APP_DIST= \ filedetails-html.lsp\ expert-html.lsp\ debug-html.lsp\ + logfile-html.lsp\ EXTRA_DIST=README Makefile DISTFILES=$(APP_DIST) $(EXTRA_DIST) diff --git a/app/logfile-html.lsp b/app/logfile-html.lsp new file mode 100644 index 0000000..13766ef --- /dev/null +++ b/app/logfile-html.lsp @@ -0,0 +1,28 @@ +<% local data, viewlibrary, page_info, session = ... %> + +<% if viewlibrary and viewlibrary.dispatch_component then + local clientdata = {} + if data.value[1] then + -- We have an array of logfile structures + for i,l in ipairs(data.value) do + clientdata = {} + for n,v in pairs(l) do + clientdata[n] = v + end + if clientdata.facility and clientdata.facility ~= "" then + clientdata.facility = nil + clientdata.filename = "/var/log/messages" + end + viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", clientdata) + end + else + for n,v in pairs(data.value) do + clientdata[n] = v.value + end + if clientdata.facility and clientdata.facility ~= "" then + clientdata.facility = nil + clientdata.filename = "/var/log/messages" + end + viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", clientdata) + end +end %> -- cgit v1.2.3