gluon/package/gluon-logging/luasrc/lib/gluon/upgrade/040-syslog
Martin Weinelt 9b19883d97 add gluon-logging package
Allows reconfigurtion of remote syslog from within site.conf.

Conflicts with the gluon-web-logging package as user made changes
will be overwritten, because this package will reconfigure the syslog
destination on every upgrade.

Resolves #1845
2020-04-30 01:54:35 +02:00

20 lines
598 B
Lua
Executable File

#!/usr/bin/lua
local site = require('gluon.site')
local uci = require('simple-uci').cursor()
local system = uci:get_first('system', 'system')
if not site.syslog.ip() then
uci:delete('system', system, 'log_remote')
uci:delete('system', system, 'log_ip')
uci:delete('system', system, 'log_port')
uci:delete('system', system, 'log_proto')
else
uci:set('system', system, 'log_remote', 1)
uci:set('system', system, 'log_ip', site.syslog.ip())
uci:set('system', system, 'log_port', site.syslog.port(514))
uci:set('system', system, 'log_proto', site.syslog.proto('udp'))
end
uci:save('system')