System log path

config system
    option log_file'/var/log/mylog

When the system is not configured with log_file, what is the path to read and write system logs using the logread / logger command? Is it the system memory, pipeline, or what?

system memory, no file.

"logread" for reading system log, and "dmesg" for kernel log.
"logger" for writing into system log

1 Like

How much system memory does the system log occupy? Is it unlimited? If I switch to file logging in the configuration file, can I reduce the system memory usage?

Look at the config file or LuCI...

By default just 64 kB, a small round-robin buffer in RAM.
(I have beefed it up in my own routers to 192 kB, so that a bit longer log is visible)

root@router4:~# cat /etc/config/system

config system
        option timezone 'EET-2EEST,M3.5.0/3,M10.5.0/4'
        option zonename 'Europe/Helsinki'
        option ttylogin '0'
        option log_size '192'

onboard flash memory of routers does not have a big write endurance. If you write logs to flash storage, the constant writes can easily wear out the flash storage and brick the device.
This is why by default the log is stored in RAM.
If you are writing logs to USB or SDcard or Sata drives this is not a problem. USB thumbdrives Sdcards and solid state drives have also limited write endurance but it is much much bigger than onboard flash of the router and just writing a log file will not wear them out.

1 Like

When you do not specify a logfile in /etc/config/system, the log data is kept in ram (see @hnyman 's posting).

The option log_size controls both - the size of the ram ring buffer and the size of the logfile.

If you want to distinguish between ram ring buffer and logfile, then use option log_size to control the size of the logfile and option log_buffer_size to control the size of the ram ring buffer.

If log_buffer_size is absent it defaults to log_size. If log_size is absent it defaults to 64 KB.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.