Page 1 of 1

add log file to /var/log/

Posted: Wed Jun 03, 2020 9:11 pm
by JMK8
I have an application that writes to a log file. I create (via sudo touch) a blank log file (foobar.log) in /var/log/foobar.log. If I then create the following entry in /etc/fstab...

Code: Select all

tmpfs                                          /var/log           tmpfs   size=50M,nodev,nosuid        0       2
...reboot and then look in /var/log/ I cannot see foobar.log if I..

Code: Select all

cat /var/log
All the other log files are visible.

I cannot compute :(

(Raspberry pi4, Raspberry Pi OS Buster)

Cheers.

Re: add log file to /var/log/

Posted: Wed Jun 03, 2020 9:18 pm
by trejan
You're mounting a tmpfs over /var/log which means any existing files in /var/log such as foobar.log will be hidden and you can't access them. The other files still exists because rsyslog recreates them.

Re: add log file to /var/log/

Posted: Thu Jun 04, 2020 10:52 am
by JMK8
I didn't realize rsyslog was doing that. Something new learned. Thanks for the pointer.