Combination of syslog-ng, luci/system/logging configuration & mwan3

Today I noticed that Luci section Network/Load Balancing/Overview/Interface Status (provided by luci-app-mwan3 package) is missing logs. I see only “No MWAN systemlog history found”. But the command grep mwan3 /var/log/messages reveals there actually are some logs.

After some digging in the forums and source code I found that luci-app-mwan3 uses logread command. If I run it I get this (several such lines):

Failed to find log object: Not found

I believe it’s somehow related to the fact that Turris OS uses syslog-ng package for logging and that there is this issue: Remote log - how to configure

Do somebody know how to solve this properly? I’m ok with local logging, I don’t need remote logging. Why logread cannot be used with syslog-ng?

Yes, it’s because of syslog-ng. But after a brief look on the mwan3 luci app source, I think it could be solved by replacing the logread command with something like cat /tmp/log/messages

Related issue https://gitlab.labs.nic.cz/turris/turris-os-packages/issues/122

2 Likes

@paja please do not start a(nother) special turris fork of this package. :wink:
/tmp/log/messages does not exist in a normal OpenWrt/LEDE environment.
I would prefer an upstream change with a simple switch like I’ve already implemented for the adblock package, e.g.:

function logread()
	local logfile

	if nixio.fs.access("/var/log/messages") then
		logfile = util.trim(util.exec("cat /var/log/messages | grep 'adblock'"))
	else
		logfile = util.trim(util.exec("logread -e 'adblock'"))
	end
	templ.render("adblock/logread", {title = i18n.translate("Adblock Logfile"), content = logfile})
end

br
dirk

2 Likes

I’m afraid that we already did this (https://gitlab.labs.nic.cz/turris/turris-os-packages/tree/test/net/mwan3-luci)
But your solution is much cleaner.

@paja
Oh thanks, I see … quick & dirty hardcoded file names … midterm it’s probably a better approach to make this more flexible (command -v in shell, luci.fs-class in LuCI)!?
BTW, are you integrating the updated adblock package plus LuCI frontend as well? :wink: