luci-app-statistics: add syslog plugin 3935/head
authorTobias Waldvogel <tobias.waldvogel@gmail.com>
Tue, 21 Apr 2020 10:34:30 +0000 (12:34 +0200)
committerTobias Waldvogel <tobias.waldvogel@gmail.com>
Tue, 21 Apr 2020 16:36:56 +0000 (18:36 +0200)
Signed-off-by: Tobias Waldvogel <tobias.waldvogel@gmail.com>
applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/syslog.js [new file with mode: 0644]
applications/luci-app-statistics/root/etc/config/luci_statistics
applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/syslog.json [new file with mode: 0644]

diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/syslog.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/syslog.js
new file mode 100644 (file)
index 0000000..7a58a16
--- /dev/null
@@ -0,0 +1,34 @@
+'use strict';
+'require baseclass';
+'require form';
+
+return baseclass.extend({
+   title: _('Syslog Plugin Configuration'),
+   description: _('The SysLog plugin receives log messages from the daemon and dispatches them to syslog.'),
+
+   addFormOptions: function(s) {
+       var o;
+
+       o = s.option(form.Flag, 'enable', _('Enable this plugin'));
+
+       o = s.option(form.ListValue, 'LogLevel', _('Log level'), _('Sets the syslog log-level.'));
+       o.value('err');
+       o.value('warning');
+       o.value('notice');
+       o.value('info');
+       o.value('debug');
+       o.rmempty=false;
+       o.default = 'warning';
+
+       o = s.option(form.ListValue, 'NotifyLevel', _('Notify level'), _('Controls which notifications should be sent to syslog.'));
+       o.value('FAILURE');
+       o.value('WARNING');
+       o.value('OKAY');
+       o.rmempty=false;
+       o.default = 'WARNING';
+   },
+
+   configSummary: function(section) {
+       return _('Syslog enabled');
+   }
+});
index d97087d1908c70f3b59487a24cec9071f26c225a..c2f27c2a51376a38fe64b7a8bdeedc9b12bc01ee 100644 (file)
@@ -42,6 +42,11 @@ config statistics 'collectd_logfile'
 config statistics 'collectd_network'
        option enable '0'
 
+config statistics 'collectd_syslog'
+   option enable '0'
+   option LogLevel 'warning'
+   option NotifyLevel 'WARNING'
+
 config statistics 'collectd_unixsock'
        option enable '0'
        option SocketFile '/var/run/collectd/query.sock'
diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/syslog.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/syslog.json
new file mode 100644 (file)
index 0000000..27bec71
--- /dev/null
@@ -0,0 +1,9 @@
+{
+   "title": "Syslog",
+   "category": "output",
+   "legend": [
+       ["LogLevel","NotifyLevel"],
+       [],
+       []
+   ]
+}