Log cannot be written when running a second instance on Ubuntu
So I have second instance of Tor configured on my Ubuntu system using torproject's Ubuntu package, version 0.4.3.6-1~focal+1
. I did that by running tor-instance-create
which created /etc/tor/instances/second/torrc
file. I edited it and configured:
Log notice file /var/log/tor2/notices.log
as the original location was /var/log/tor/notices.log
. But now I have a problem that the instance does not start with the following error:
Aug 01 02:06:17.000 [warn] Couldn't open file for 'Log notice file /var/log/tor2/notices.log': Read-only file system
The issue is that tor is locked down where it can write. I fixed that by editing /lib/systemd/system/tor@.service
and added:
ReadWriteDirectories=-/var/log/tor2
ReadWriteDirectories=-/var/log/tor
But now this is overridden every time the package gets updated. So I have not seen any instructions how to configure logging to files (instead of syslog, as what it is the default) in tor-instance-create
's man page. So, I think it would be useful if tor-instance-create
's man page include some information how to configure logging to a file which would be both writable and supported logrotate (I had to copy /etc/logrotate.d/tor
to /etc/logrotate.d/tor2
to configure rotation for the second instance as well). Even better, the tor-instance-create
script could configure things accordingly based on the first instance's configuration?