How to set permissions for files which get rolled over?

Hi,

One application that I have generates log files into a specific folder in SUSE. When the size of the log file reaches 50 MB, it gets rolled over and it is stored as testlog_1.log and the new events are logged in testlog.log

When I set a chmod -R 744 on the directory of these logs, it applies only to the files that were present at that moment. So, the new files that are generated afterwards don't get the same permissions.

One way to achieve this was to run a cron job for every 30 mins and execute the chmod command.

But is there a simpler and feasible way?

Thanks in advance,
Gopi.

You can set it in logrotate.conf per log file you are rotating (not directory)

Check option in logrotate manual :
create mode owner group

Thanks for the reply. The log rotation is taken care by the application itself. Automatically the logs get rotated. But i wanted to give read only access to users other than root.

How is the application rotating the logs ?
Does it copy and make it zero size or something like that ?

If the files get zeroed after rotation, then you can use ACL to give read permission to another user, beside root.
If the app creating (as root) new filename (log), then you will need to setup your application to make the neccesary permission changes after rotation.

Hope that helps
Regards
Peasant.

set a umask value in for the user that creates the logs, then they will be created with the permissions you specify instead of what im guessing is your system default.