summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--syslog-config-html.lsp34
-rw-r--r--syslog-expert-html.lsp54
-rw-r--r--syslog-model.lua35
-rw-r--r--syslog-status-html.lsp9
-rw-r--r--syslog-superexpert-html.lsp23
5 files changed, 80 insertions, 75 deletions
diff --git a/syslog-config-html.lsp b/syslog-config-html.lsp
index 9ef330a..48ba1b7 100644
--- a/syslog-config-html.lsp
+++ b/syslog-config-html.lsp
@@ -7,13 +7,38 @@
<DD><input class="radio" type="radio" name="loglevel" value="2" <? if (tostring(view.config.loglevel) == "2") then io.write('checked') end ?>>Enable
<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>Disable</DD>
-<H2>Guided setup</H2>
+<H2>Guided config</H2>
+<H3>General settings</H3>
+
+<DT>Log to given file</DT>
+<DD><input type="text" class="text" name="smallerlogg" value="<?= view.config.logfile ?>"/>
+<P>(default=/var/log/messages)</P></DD>
+
+<DT>Set local log level</DT>
+<DD><input class="radio" type="radio" name="loglevel" value="1" <? if (tostring(view.config.loglevel) == "1") then io.write('checked') end ?>>1
+<input class="radio" type="radio" name="loglevel" value="2" <? if (tostring(view.config.loglevel) == "2") then io.write('checked') end ?>>2
+<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>3
+<input class="radio" type="radio" name="loglevel" value="4" <? if (tostring(view.config.loglevel) == "4") then io.write('checked') end ?>>4
+<input class="radio" type="radio" name="loglevel" value="5" <? if (tostring(view.config.loglevel) == "5") then io.write('checked') end ?>>5
+<input class="radio" type="radio" name="loglevel" value="" <? if (tostring(view.config.loglevel) == "") then io.write('checked') end ?>>Default
+<p>(1=Quiet, 5=Noisy, Default=Not specifyed any loglevel in the config)</P>
+</DD>
+
+<DT>Smaller logging output</DT>
+<DD><input type="checkbox" name="smallog" <? if (view.config.smallog) then io.write('checked') end ?>/></DD>
+<H3>Save logs for a longer period</H3>
+<DT>Max size (KB) before rotate</DT>
+<DD><input type="text" class="text" name="maxsize" value="<?= view.config.maxsize ?>"/>
+<p>(default=200KB, 0=off)</p>
+</DD>
-<H3>Remote logging</H3>
+<DT>Number of rotated logs to keep</DT>
+<DD><input type="text" class="text" name="logrotate" value="<?= view.config.logrotate ?>"/>
+<p>(default=1, max=99, 0=purge)</p>
+</DD>
-<DT>Activate remote logging</DT>
-<DD><input type="checkbox" name="smallog" <? if (view.config.smallog) then io.write('checked') end ?>/></DD>
+<H3>Remote logging</H3>
<DT>Log to IP or hostname on PORT</DT>
<DD><input type="text" class="text" name="host" value="<?= view.config.remote ?>"/>
@@ -23,3 +48,4 @@
<DT>Apply settings</DT>
<DD><input class="submit" type="submit" value="Apply"/></DD>
+
diff --git a/syslog-expert-html.lsp b/syslog-expert-html.lsp
index c8f5570..0852c31 100644
--- a/syslog-expert-html.lsp
+++ b/syslog-expert-html.lsp
@@ -8,44 +8,24 @@
<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>Disable</DD>
<H2>Expert config</H2>
-<H3>General settings</H3>
-
-<DT>Log to given file</DT>
-<DD><input type="text" class="text" name="smallerlogg" value="<?= view.config.logfile ?>"/>
-<P>(default=/var/log/messages)</P></DD>
-
-<DT>Set local log level</DT>
-<DD><input class="radio" type="radio" name="loglevel" value="1" <? if (tostring(view.config.loglevel) == "1") then io.write('checked') end ?>>1
-<input class="radio" type="radio" name="loglevel" value="2" <? if (tostring(view.config.loglevel) == "2") then io.write('checked') end ?>>2
-<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>3
-<input class="radio" type="radio" name="loglevel" value="4" <? if (tostring(view.config.loglevel) == "4") then io.write('checked') end ?>>4
-<input class="radio" type="radio" name="loglevel" value="5" <? if (tostring(view.config.loglevel) == "5") then io.write('checked') end ?>>5
-<input class="radio" type="radio" name="loglevel" value="" <? if (tostring(view.config.loglevel) == "") then io.write('checked') end ?>>Default
-<p>(1=Quiet, 5=Noisy, Default=Not specifyed any loglevel in the config)</P>
-</DD>
-
-<DT>Smaller logging output</DT>
-<DD><input type="checkbox" name="smallog" <? if (view.config.smallog) then io.write('checked') end ?>/></DD>
-
-<H3>Save logs for a longer period</H3>
-<DT>Max size (KB) before rotate</DT>
-<DD><input type="text" class="text" name="maxsize" value="<?= view.config.maxsize ?>"/>
-<p>(default=200KB, 0=off)</p>
-</DD>
-
-<DT>Number of rotated logs to keep</DT>
-<DD><input type="text" class="text" name="logrotate" value="<?= view.config.logrotate ?>"/>
-<p>(default=1, max=99, 0=purge)</p>
-</DD>
-
-<H3>Remote logging</H3>
-
-<DT>Log to IP or hostname on PORT</DT>
-<DD><input type="text" class="text" name="host" value="<?= view.config.remote ?>"/>
-<P>(default PORT=514/UDP)</P></DD>
+
+<h3>File details</h3>
+
+<dt>File name</dt>
+<dd>/etc/conf.d/syslogd</dd>
+
+<dt>File size</dt>
+<dd>60</dd>
+
+<dt>Last modified</dt>
+<dd>Mon Aug 20 16:58:19 2007</dd>
+
+<h3>File content</h3>
+
+<form name="myform" action="" method="POST">
+<input name="name" type=hidden value="">
+<textarea name="modifications"></textarea>
<H2>Save and apply above settings</H2>
<DT>Apply settings</DT>
<DD><input class="submit" type="submit" value="Apply"/></DD>
-
-
diff --git a/syslog-model.lua b/syslog-model.lua
index 59747d1..ac37572 100644
--- a/syslog-model.lua
+++ b/syslog-model.lua
@@ -25,23 +25,34 @@ local is_running = function( process )
return statusreport
end
--- ################################################################################
--- EXPERIMENTAL LOCAL FUNCTIONS
-
local function readopts(optname)
local opts = {}
local line
local f = io.open("/etc/conf.d/syslog", "r")
- if f == nil then
+ if (f == nil) then
return nil
end
for line in f:lines() do
- local optstr = string.match(line, "^" .. optname .. "=\"?(.*)\"?")
+ local optstr = string.match(line, "^" .. optname .. "=\"?(.*)%\"+")
if optstr then
- local t = {}
- for k, v in string.gmatch(optstr, "(%C*)") do
--- for k, v in string.gmatch(optstr, "(-%S+)%s+(%S+)") do
- opts[k] = optstr
+ local option = ""
+ local optvalue = ""
+ opts["org"]=optstr
+ for j = 1, string.len(optstr) do
+ if (string.sub(optstr, j, j) == "-") then
+ option=string.sub(optstr, j, j+1)
+ for k = j+1, string.len(optstr) do
+ if (string.sub(optstr, k, k) == "-") then
+ opts[option] = string.match(string.sub(optstr, j+2, k-1),"^%s*(.*)%s?")
+ break
+ end
+ if (k == string.len(optstr)) then
+ opts[option] = string.match(string.sub(optstr, j+2, k),"^%s*(.*)%s?")
+ break
+ end
+
+ end
+ end
end
end
end
@@ -49,6 +60,10 @@ local function readopts(optname)
end
-- ################################################################################
+-- EXPERIMENTAL LOCAL FUNCTIONS
+
+
+-- ################################################################################
-- PUBLIC FUNCTIONS
function getstatus()
@@ -120,6 +135,7 @@ function priv.enable(opts)
end
--]]
+--[[
-- this func does not need privileges
local function readopts()
local opts = {}
@@ -137,3 +153,4 @@ local function readopts()
end
return opts
end
+--]]
diff --git a/syslog-status-html.lsp b/syslog-status-html.lsp
index 1192c49..e923b1b 100644
--- a/syslog-status-html.lsp
+++ b/syslog-status-html.lsp
@@ -12,7 +12,7 @@
<H3>GENERAL CONFIGURATIONS</H3>
<? if (view.status.logfile) then ?>
-<dt>Logfile</dt>
+<dt>Locally logging to</dt>
<dd><?= view.status.logfile ?></dd>
<? end ?>
@@ -23,4 +23,9 @@
-
+<?
+---[[ DEBUG INFORMATION
+require("debugs")
+io.write(debugs.variables(view))
+--]]
+?>
diff --git a/syslog-superexpert-html.lsp b/syslog-superexpert-html.lsp
deleted file mode 100644
index cac5f57..0000000
--- a/syslog-superexpert-html.lsp
+++ /dev/null
@@ -1,23 +0,0 @@
-<? local view = ... ?>
-
-<h1>EDIT CONFIGURATION</h1>
-
-<h2>File details</h2>
-
-<dt>File name</dt>
-<dd>/etc/conf.d/syslogd</dd>
-
-<dt>File size</dt>
-<dd>60</dd>
-
-<dt>Last modified</dt>
-<dd>Mon Aug 20 16:58:19 2007</dd>
-
-<h3>File content</h3>
-
-<form name="myform" action="" method="POST">
-<input name="name" type=hidden value="">
-<textarea name="modifications"></textarea>
-
-<input type="submit" name="cmd" value="Apply" class="submit"><p class="error"></p></form>
-