I want to write the syslog to a flash drive in addition to the standard ring buffer; so within /etc/config/system, I added the line:
log_file option '/mnt/log/system.log'
However, upon rebooting the router, I don't see the logfile created.
I did use the luci "app" (from the block-mount package) to auto-mount the flash drive at /mnt/log and all my other ulogd logs are working fine using that directory, so I don't believe it is a mounting issue.
Does it have something to do with the logd vs mounting startup order? I'm not that familiar with how the files in /etc/rc.d work.
package system
config system
option ttylogin '1'
option log_size '64'
option log_file '/mnt/log/openwrt.log'
option urandom_seed '0'
option log_proto 'udp'
option conloglevel '8'
option cronloglevel '5'
option hostname 'LJNetCBP'
option zonename 'America/Chicago'
option timezone 'CST6CDT,M3.2.0,M11.1.0'
config timeserver 'ntp'
list server '0.openwrt.pool.ntp.org'
list server '1.openwrt.pool.ntp.org'
list server '2.openwrt.pool.ntp.org'
list server '3.openwrt.pool.ntp.org'
"ll /mnt/" outputs:
drwxr-xr-x 1 root root 1024 Jan 9 12:07 ./
drwxr-xr-x 1 root root 1024 Dec 31 16:42 ../
drwxr-xr-x 4 root root 1024 Jan 9 12:21 log/
"ll /mnt/log/" outputs:
drwxr-xr-x 4 root root 1024 Jan 9 12:21 ./
drwxr-xr-x 1 root root 1024 Jan 9 12:07 ../
drwxr-xr-x 2 root root 1024 Jan 9 12:21 snort/
drwxr-xr-x 2 root root 1024 Jan 10 22:09 ulogd/
if I do these together:
"/etc/init.d/system restart" (no output; success)
"/etc/init.d/log restart" (no output; success)
"ll /mnt/log"
Then I finally see it, and it starts to work. Thank you... However...
drwxr-xr-x 4 root root 1024 Jan 11 07:09 ./
drwxr-xr-x 1 root root 1024 Jan 9 12:07 ../
-rw------- 1 root root 152 Jan 11 07:10 openwrt.log
drwxr-xr-x 2 root root 1024 Jan 9 12:21 snort/
drwxr-xr-x 2 root root 1024 Jan 10 22:09 ulogd/
However, if I do this:
rm /mnt/log/openwrt.log
reboot
ll /mnt/log
drwxr-xr-x 4 root root 1024 Jan 11 2023 ./
drwxr-xr-x 1 root root 1024 Jan 9 12:07 ../
drwxr-xr-x 2 root root 1024 Jan 9 12:21 snort/
drwxr-xr-x 2 root root 1024 Jan 10 22:09 ulogd/
Based on the config files; it should work even though I reboot the router.
I still suspect it has something to do with boot order.