Here is the line to start a process in systemd service and save log to /var/log/besu
:
ExecStart=/bin/sh -c "$HOME/bin/besu/bin/besu --config-file=$HOME/bin/besu_network/node1/config.toml >> /var/log/besu/node1.log 2>&1"
However since the user does not have the write permission under /var/log
and it throws error. How to give a sudo
permission in the line above to create a log file, but not add the user to sudoer group?
You could sudo a symbolic link into /var/log which points to a log file elsewhere that the user has write permission to.
OR
You could add the user to the
syslog
group so they then have write permission to/var/log
Of course then that user could go end edit/delete other system logs but if it's you personally or a trusted user...So for my
/var/log
I can see it's owner:group isroot:syslog
So modify the user and add the syslog group:
sudo usermod -a -G syslog <USERNAME_HERE>
You will probably have to logout/login for the change to take effect, not sure if there is a way to refresh users/groups dynamically.