Should log write to /var/log?

should log write to /var/log?
or which directory is good for keep file after reboot for application(ipk)

By default, /var/ is tmpfs backed and accordingly loster over a reboot.

Writes should be kept to a minimum in general, both in terms of size and frequency. For three reasons, to avoid it overflowing, in order not to damage the flash and for resiliency (surviving an unclean poweroff).

2 Likes

openwrt do not recommend to persist log?
if i have to , what is the best method?

All your questions are answered in the wiki:

1 Like

Format a usb flash drive as f2fs and mount it as /var/log I've got one doing heavy logging using f2fs for over a year

3 Likes

You have the log options: target IP, TCP/UDP, and port option for a reason.
The best persistent logging option is to have a free standing log server.

1 Like

got it , thanks!