Clear System or Kernel Log

Is possible to clear the system log or kernel log
with web or terminal ?


The logs are kept in fixed-size ring buffers in memory -- like a scroll buffer in a terminal limited to say 1000 lines where new lines make old ones fall off the back end. What you see with "stick" OpenWrt in a terminal or LuCI is the most recent content in that buffer, not the contents of a file.

What are you trying to achieve as a goal?


but is possible to clear the buffer ?

Kernel ring buffer is reportedly managed by

jeff@office:~$ dmesg --help
BusyBox v1.29.2 () multi-call binary.

Usage: dmesg [-c] [-n LEVEL] [-s SIZE]

Print or control the kernel ring buffer

	-c		Clear ring buffer after printing
	-n LEVEL	Set console logging level
	-s SIZE		Buffer size
	-r		Print raw message buffer

(I use syslog_ng so I can't easily comment on the built-in logging of OpenWrt.)

1 Like

And similarly, system log can be cleared simply by restarting the log daemon with /etc/init.d/log restart

See example:

root@router1:~# logread -l 4
Sat Jan  5 23:55:05 2019 hostapd: wlan1: STA 44:65:0d:2d:1f:76 IEEE 802.11: disassociated
Sat Jan  5 23:55:20 2019 daemon.warn odhcpd[1505]: DHCPV6 RENEW IA_NA from 000100011b8b... on br-lan: ok 2001:...::180/128 fd1b:...::180/128
Sun Jan  6 00:05:35 2019 dropbear[10399]: Child connection from
Sun Jan  6 00:05:35 2019 authpriv.notice dropbear[10399]: Pubkey auth succeeded for 'root' with key sha1!! 25:30... from

root@router1:~# /etc/init.d/log restart

root@router1:~# logread -l 5
Thu Jan  1 02:00:00 1970 kern.emerg kernel: