Hi guys.
I'm facing strange issues with my router and it becomes unreachable from time to time. So I have to restart it and after there are no OpenWRT logs.
According this article https://openwrt.org/docs/guide-user/base-system/log.essentials
I created 2 lines
in a /etc/config/system file. Restarted services service log restart && service system restart and now there are logs on my USB drive.
But they exist like a 2 hours and after that, they will be overwritten by a new records.
In my example I'm getting logs.log file with records during last hour. And also there is logs.log.old where I can find one more hour of logs.
Could you please explain, how can I store all logs from router's boot and till current time?
We really need to figure out how to get the wiki search fixed. It almost never gives up anything other than a billion ToH entries which are rarely useful, so I fall back on external searches and those are often hit'n'miss.
If log_type is file, as mentioned in the wiki, the file will grow without an upper boundary, as in, it will just keep appending new lines to the end of the file. log_size is therefore, ignored.
For now it looks like that
-rw------- 1 root root 443.3K Oct 9 12:08 syslog.log
-rw------- 1 root root 1.0M Oct 8 15:00 syslog.log.old
syslog.log.old stores logs from Sun Oct 6 21:54:27 till Tue Oct 8 15:00:00
syslog.log stores logs from Tue Oct 8 15:02:00 till Wed Oct 9 11:06:00
So I have logs for almost 3 days. And that was my goal.
At the same time, OpenWRT interface Status - Logs gives me all records from
Mon Oct 7 18:59:10 till Wed Oct 9 11:06:00
I hope, that when syslog.log will reach 1M size, an old one syslog.log.old will be overwritten. But let's wait a couple of days. I'll get back and will update that topic.
So, it's not ignoring the value from log_size? The wiki makes no mention of logd renaming the log files at certain boundaries. Or maybe log_size is causing the log_type option to be ignored. I'll have to check the code later.
Yep, log_size works. For now there are 2 files
-rw------- 1 root root 628.2K Oct 9 16:01 syslog.log
-rw------- 1 root root 1.0M Oct 8 15:00 syslog.log.old
so it was my goal.
Thanks to all for helping me. And many-many thanks to @Cthulhu88 and @flygarn12.
I think we can assume that my problem is resolved.
And yes, it only backs a single .old, the previous one is replaced.
logd: ring buffer in RAM
logread: writes messages stored in the ring buffer to a file
Since they are two different applications, you want to have two different buffer sizes, one for RAM and one for the file (the default behavior is to use log_size for the ring buffer, if log_buffer_size is not defined), so: