Reputation: 2465
There is an option in rsyslog configuration to set the permission & ownership of the log file created.
$fileOwner sv
if $programname contains 'my_process' then /var/log/my_process.log
If the log file (/var/log/my_process.log
) is not present, the file will be created with owner as "sv" user. Manual
But this will change the setting for all the forthcoming files as well.
Is there a way to the set the permission of only a particular log file?
Upvotes: 1
Views: 10001
Reputation: 2465
I've found a way that works. After the configuration, reset the variable back to its default value.
$fileOwner sv
if $programname contains 'my_process' then /var/log/my_process.log
$fileOwner root
Upvotes: 5