Logs location - a philosophical question
by taylorkh from LinuxQuestions.org on (#5KNG7)
For years I have been running a systemd service which I wrote to access ProtonVPN on a small server which then shares the connection to my LAN. Proton recently released their "official" Linux VPN command line client. Of course they had to fix things and the new client will not run as root as far as I can tell. I think I know why and perhaps how to fix that. However, the path of less resistance is to run the service under my user account. That I am working on.
An issue arises with the logs I write from my service. Currently the service runs as root and I can simply write the logs from my script to /var/log/. As my user account I do NOT have write permission to that directory. I see three possibilities:
1 - Grant my user account write access to /var/log/
2 - Put the logs elsewhere - Is there a preferred place for logs generated by a civilian user?
3 - Use syslog to handle the logs from my service. I have no idea how to do that but probably should learn.
I am looking for suggestions and advice.
TIA,
Ken
An issue arises with the logs I write from my service. Currently the service runs as root and I can simply write the logs from my script to /var/log/. As my user account I do NOT have write permission to that directory. I see three possibilities:
1 - Grant my user account write access to /var/log/
2 - Put the logs elsewhere - Is there a preferred place for logs generated by a civilian user?
3 - Use syslog to handle the logs from my service. I have no idea how to do that but probably should learn.
I am looking for suggestions and advice.
TIA,
Ken