openwrt / openwrt

This repository is a mirror of https://git.openwrt.org/openwrt/openwrt.git It is for reference only and is not active for check-ins. We will continue to accept Pull Requests here. They will be merged via staging trees then into openwrt.git.
Other
19.99k stars 10.39k forks source link

log_file contents only contains partial syslog contents #12295

Open virtuald opened 1 year ago

virtuald commented 1 year ago

Describe the bug

When using logd in the default OpenWRT configuration, it does not store the entirety of the log buffer in the logfile, but only messages emitted after the logger starts. Even though logd starts early in the boot process, it misses most of the interesting messages that might happen at bootup because everything has started by the time it finishes initializing.

This has been reported in the forum previously: https://forum.openwrt.org/t/logs-are-partially-missing-when-saving-to-usb-drive/110386

OpenWrt version

r20028-43d71ad93e

OpenWrt target/subtarget

x86/64

Device

QEMU Standard PC (i440FX + PIIX, 1996)

Image kind

Official downloaded image

Steps to reproduce

  1. Add option log_file '/foo' to /etc/config/system
  2. Reboot

Actual behaviour

Nothing early in the boot process is in the /foo log file

Expected behaviour

The /foo logfile should contain anything that is in the log buffer at bootup

Additional info

syslog-ng and rsyslog both have the expected behavior

Diffconfig

No response

Terms

brada4 commented 1 year ago

Does it affect forwarded packets, i.e dows it send collected log out when network appears?

virtuald commented 1 year ago

Does it affect forwarded packets, i.e dows it send collected log out when network appears?

I don't use that functionality, so I don't know. All of the data is in the log buffer, since it's available by executing 'logread'. It just isn't written to file.