diff --git a/docs/package/gluon-web-logging.rst b/docs/package/gluon-web-logging.rst new file mode 100644 index 00000000..ddb9f573 --- /dev/null +++ b/docs/package/gluon-web-logging.rst @@ -0,0 +1,5 @@ +gluon-web-logging +================= + +The *gluon-web-logging* package adds a new section to advanced settings +to allow GUI-based configuration of a remote syslog server. diff --git a/package/gluon-web-logging/Makefile b/package/gluon-web-logging/Makefile new file mode 100644 index 00000000..7a7d0350 --- /dev/null +++ b/package/gluon-web-logging/Makefile @@ -0,0 +1,38 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-web-logging +PKG_VERSION:=1 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include ../gluon.mk + +PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) + + +define Package/gluon-web-logging + SECTION:=gluon + CATEGORY:=Gluon + DEPENDS:=+gluon-web-admin + TITLE:=UI for remote syslog configuration +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile + $(call GluonBuildI18N,gluon-web-logging,i18n) + $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/) +endef + +define Package/gluon-web-logging/install + $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/ + $(call GluonInstallI18N,gluon-web-logging,$(1)) +endef + +$(eval $(call BuildPackage,gluon-web-logging)) diff --git a/package/gluon-web-logging/i18n/de.po b/package/gluon-web-logging/i18n/de.po new file mode 100644 index 00000000..8e00574f --- /dev/null +++ b/package/gluon-web-logging/i18n/de.po @@ -0,0 +1,15 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "" +"If you want to use a remote syslog server, you can set it up here. " +"Please keep in mind that the data is not encrypted, which may cause " +"individual-related data to be transmitted unencrypted over the internet." +msgstr "" +"Wenn du einen Remote-Syslog-Server nutzen möchtest, dann kannst du ihn hier " +"eintragen. Bitte beachte, dass diese Daten nicht verschlüsselt werden. Dies " +"kann dazu führen, dass personenbezogene Daten unverschlüsselt über das Internet " +"übertragen werden." + +msgid "Logging" +msgstr "Logging" diff --git a/package/gluon-web-logging/i18n/gluon-web-logging.pot b/package/gluon-web-logging/i18n/gluon-web-logging.pot new file mode 100644 index 00000000..e35c537c --- /dev/null +++ b/package/gluon-web-logging/i18n/gluon-web-logging.pot @@ -0,0 +1,11 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "" +"If you want to use a remote syslog server, you can set it up here. " +"Please keep in mind that the data is not encrypted, which may cause " +"individual-related data to be transmitted unencrypted over the internet." +msgstr "" + +msgid "Logging" +msgstr "" diff --git a/package/gluon-web-logging/luasrc/lib/gluon/web/controller/admin/logging.lua b/package/gluon-web-logging/luasrc/lib/gluon/web/controller/admin/logging.lua new file mode 100644 index 00000000..8dea6228 --- /dev/null +++ b/package/gluon-web-logging/luasrc/lib/gluon/web/controller/admin/logging.lua @@ -0,0 +1 @@ +entry({"admin", "logging"}, model("admin/logging"), _("Logging"), 85) diff --git a/package/gluon-web-logging/luasrc/lib/gluon/web/model/admin/logging.lua b/package/gluon-web-logging/luasrc/lib/gluon/web/model/admin/logging.lua new file mode 100644 index 00000000..6357fbf9 --- /dev/null +++ b/package/gluon-web-logging/luasrc/lib/gluon/web/model/admin/logging.lua @@ -0,0 +1,45 @@ +local uci = require('simple-uci').cursor() +local system = uci:get_first('system', 'system') + +local f = Form(translate('Logging'), translate( + "If you want to use a remote syslog server, you can set it up here. " + .. "Please keep in mind that the data is not encrypted, which may cause " + .. "individual-related data to be transmitted unencrypted over the internet." +)) +local s = f:section(Section) + +local enable = s:option(Flag, 'log_remote', translate('Enable')) +enable.default = uci:get_bool('system', system, 'log_remote') +function enable:write(data) + uci:set('system', system, 'log_remote', data) +end + +local ip = s:option(Value, 'log_ip', translate('IP')) +ip.default = uci:get('system', system, 'log_ip') +ip:depends(enable, true) +ip.optional = false +ip.placeholder = '0.0.0.0' +ip.datatype = 'ipaddr' +function ip:write(data) + uci:set('system', system, 'log_ip', data) +end + +local port = s:option(Value, 'log_port', translate('Port')) +port.default = uci:get('system', system, 'log_port') +port:depends(enable, true) +port.optional = true +port.placeholder = 514 +port.datatype = 'irange(1, 65535)' +function port:write(data) + if data ~= nil then + uci:set('system', system, 'log_port', data) + else + uci:delete('system', system, 'log_port') + end +end + +function f:write() + uci:commit('system') +end + +return f