Suppress noisy netifd messages from syslog

Starlink assigns my router short-lived leases (5 minutes), so my syslog is getting cluttered with messages like:

daemon.notice netifd: wan (####): udhcpc: sending renew to server
daemon.notice netifd: wan (####): udhcpc: lease of ###.###.###.# obtained from ###.###.###.#, lease time 300

I want to suppress them, as they drown out anything useful when opening Status | System Log.

If I understand https://openwrt.org/docs/techref/netifd correctly, I should be able to modify /etc/init.d/network to append the -l 2 switch to the command and make netifd only log warning or more severe messages.

I tried that but it didn't seem to have any effect (even after rebooting the router afterward). Any suggestions?

Here's the full content of my /etc/init.d/network file: https://pastebin.com/raw/WngS4HCz

This didn't work either:

procd_set_param command /sbin/netifd
procd_append_param command -l 2

Problem solved.

I believe the documentation at https://openwrt.org/docs/techref/netifd is WRONG.

If you look in the source code file for netifd.h it contains:

enum {
	L_CRIT,
	L_WARNING,
	L_NOTICE,
	L_INFO,
	L_DEBUG
};

and in main.c:

	case 'l':
		log_level = atoi(optarg);

So the log levels are zero-indexed.

The documentation at https://openwrt.org/docs/techref/netifd presently shows them as one-indexed. It should be corrected to read:

Level is specified as an integer:
  0 = L_CRIT
  1 = L_WARNING
  2 = L_NOTICE (default)
  3 = L_INFO
  4 = L_DEBUG

I tried to fix it myself as a service to the community, but don't have access and there's more friction than I'm willing to overcome at this point to gain it (trying to solve several issues at the moment and this netifd thing is just step 1 of many).

Maybe someone here with write access to the wiki can confirm my findings and correct the article.

(If I sound peevish, it's because I'm new to OpenWRT and this isn't the first time I've been led astray for hours by poor / disorganized / unclear documentation).

3 Likes

Good catch, I looked in the source code and the default log level is indeed L_NOTICE, so in the end you used -l 1 to only get warnings?

That's correct. More precisely, warnings and critical events.

2 Likes

Fixed.

  • Your assistance is appreciated
  • It's likely the the developer and Wiki editor had no clue of the other

Don't be discouraged - be encouraged to assist too.

3 Likes

Awesome, thanks!

1 Like