Change permissions for log_file

Hello,
I enabled logging like this:

log_file = "/var/log/nomad.log"
log_rotate_duration = "24h"
log_rotate_max_files = 15

and the log_file permissions are 640, but for some internal processes to work properly, i would like to change that permissions to 644, but i dont see an configuration flag to use. can you help me? thanks!

if I read this correctly, 640 is hardcoded at file creation, so i guess there’s no way to pass a different mode

maybe you can consider this as a feature request?

Hi @sandrotosi,

As you have discovered there is no configuration parameters to alter the permissions used to create the default log file. It is currently expected that any changes are handled outside of Nomad via something like this Ansible task. Feel free to open a feature request, if you would like this option added to Nomad.

Thanks,
jrasell and the Nomad team

This will not persist once the log file is rotated, correct? Maybe a system cron (via crontab) could be a better hack than an Ansible?

Hi there,

To change the permissions of your log file, you can use the chmod command in your terminal. Simply run chmod 644 /var/log/nomad.log to set the Lotus365 permissions to 644. Hope this helps.

it doesnt help. the moment the log file rotates, the permissions are reset to 640

  1. you cannot disable rotation in nomad (to do it yourself with logrotate and correct file permissions)
  2. you cannot set your own permissions on file, so nomad always rotates log and always sets its own permissions

two advises provided in thread are unrelated to asked question. one of them: "It is currently expected that any changes are handled outside of Nomad via something like this Ansible task " is even misleading, because nomad creates file by itself, and ansible task will not help any way. (thanks for link to your repo)

To change the log file permissions to 644, you can use a custom script to adjust permissions after log rotation. Add a cron job or modify your Beflik logging setup script to include chmod 644 /var/log/nomad.log. Hope this helps.