I use openwrt since version 14.07
and one thing always bothered me is the amount of log messages when using logread
executable. It makes log inspection very difficult.
After reading some stuff, like System log level with logd, I decided replaced logd
to another logger service, like rsyslog
.
Basically I want to to filter messages to log me only err
and critical
messages, rsyslog
fit like a glove for my case.
// /etc/rsyslog.d
# ... config
# Exclude unnecessary messages
*.=notice,*.=info,*.=debug stop
*.*,mail.none,authpriv.none,cron.none,news.none,uucp.none,kern.none /var/log/messages
#... more config
This is working quite well. If I tail /var/log/messages
, I can see only warning, error and critical messages.
But in counterpart, it seems I lost the ability to use Luci to check logs. When I go to Luci > Status > System log
it display the following message.
Unable to load log data: Executable not found
Checking the Luci source code, it seems this part depends on logread to display logs accordingly. So I made a little workaround and created a fake logread
executable, that basically cat /var/log/messages
for me. It is working ok on Luci web interface until now.
/root/bin/logread -> /sbin/user/logread
#!/bin/ash
# Fake logread executable
# display last N messages
tail -n 1000 /var/log/messages
Little hackish, but it does the job.
My real question is: is there a better way to filter logging? I feel I did a lot of workarounds just to filter notice/info/debug messages, like hostapd messages (since it is not possible to filter it on hostapd config).