mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-26 20:08:07 +11:00
fixed up network syslog stuff
This commit is contained in:
parent
284c67994e
commit
4aba85513a
@ -18,7 +18,7 @@ local listeners = {}
|
|||||||
local timers = {}
|
local timers = {}
|
||||||
|
|
||||||
local function filter(msg,level,service)
|
local function filter(msg,level,service)
|
||||||
if level >= cfg.minlevel then
|
if level <= cfg.minlevel then
|
||||||
return cfg.write, (cfg.relay and havenet)
|
return cfg.write, (cfg.relay and havenet)
|
||||||
end
|
end
|
||||||
return false, false
|
return false, false
|
||||||
@ -26,7 +26,6 @@ end
|
|||||||
|
|
||||||
function reload()
|
function reload()
|
||||||
local f = io.open("/etc/syslogd.cfg","rb")
|
local f = io.open("/etc/syslogd.cfg","rb")
|
||||||
print(f)
|
|
||||||
if f then
|
if f then
|
||||||
local newcfg = serial.unserialize(f:read("*a"))
|
local newcfg = serial.unserialize(f:read("*a"))
|
||||||
f:close()
|
f:close()
|
||||||
@ -57,18 +56,16 @@ local function wentry(_,msg,level,service,host)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if drelay then
|
if drelay then
|
||||||
net.rsend(cfg.relayhost, cfg.port, entry)
|
net.usend(cfg.relayhost, cfg.port, entry)
|
||||||
end
|
end
|
||||||
print(msg,level,service,host)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function remote_listener(_,from,port,data)
|
local function remote_listener(_,from,port,data)
|
||||||
if port ~= cfg.port then return false end
|
if port ~= cfg.port then return false end
|
||||||
local ut = computer.uptime()
|
|
||||||
local service, level, msg = data:match("(.-)\t(%d)\t(.+)")
|
local service, level, msg = data:match("(.-)\t(%d)\t(.+)")
|
||||||
if not service and not level and not msg then return false end
|
if not service and not level and not msg then return false end
|
||||||
|
msg, level, service = tostring(msg),tonumber(level),tostring(service)
|
||||||
wentry(nil,msg,level,service,from)
|
wentry(nil,msg,level,service,from)
|
||||||
print(msg,level,service)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function start()
|
function start()
|
||||||
|
Loading…
Reference in New Issue
Block a user