Showing posts with label LOG. Show all posts
Showing posts with label LOG. Show all posts

Sunday, June 2, 2019

Unix root app log file permission

We may need some log files read access for other user process for tailing logs or monitoring logs or collecting logs using collectd, telegraf, splunk, etc. So When an application started by root user, all the log files or runtime files are created with only root user access permission. Changing the file permission will not helps since log files are rotated after sometime with only root user access(600). Here sharing one way of making only log file readable by all the users.

# Before starting the application create directories and set permission using setfacl. From below example application should be creating the log files in /opt/application/logs path.

mkdir -p /opt/application/logs

chmod 755 /opt/application
chmod 755 /opt/application/
chmod 755 /opt/application/logs

setfacl -d -m u:telegraf:r /opt/application/logs

touch /opt/application/audit.log

Then start your application