JMK8
Posts: 42
Joined: Tue Apr 28, 2015 10:00 am

add log file to /var/log/

Wed Jun 03, 2020 9:11 pm

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.

trejan
Posts: 1874
Joined: Tue Jul 02, 2019 2:28 pm

Re: add log file to /var/log/

Wed Jun 03, 2020 9:18 pm

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.

JMK8
Posts: 42
Joined: Tue Apr 28, 2015 10:00 am

Re: add log file to /var/log/

Thu Jun 04, 2020 10:52 am

I didn't realize rsyslog was doing that. Something new learned. Thanks for the pointer.

Return to “General discussion”