We have Oracle Linux Server release 7.4, with kernel version: 4.1.12-103.7.1.el7uek.x86_64
We have an application (Oracle RAC) that creates and/or adds to about 1,500 log files every day. These log files are all in a single subdirectory of the Oracle executables. Oracle does not offer a configuration option or parameter to direct these log files to a different volume (like a log volume, where we wouldn't risk filling up the executable volume).
I'm trying to use logrotate to help me manage these logs, but I haven't found a combination of parameters yet for logrotate that works reliably. One of the complicating factors is the fact that these log files are produced by three different Linux user accounts (root, oracle and emagent). These log files do all get created with same group name: oinstall. Another complicating factor is the permissions in the parent directory: "rwxrwxr-x". The Oracle software install creates this directory and sets these permissions. Many of these log files are very small and get created with unique file names (that include a five or six digit number). Some of these log files though keep the same (non-unique) name every day and can grow rather large (at least 10s of mbytes).
Here is my latest attempt at a config file (named: crs_logs.conf in: /etc/logrotate.d) for logrotate:
su oracle oinstall
create 0640 oracle oinstall
I plan to add a "postrotate" command to this, to move files more than two days old out to a log volume, if I can get this basic logrotate script to work.
When I try this manually (with; "logrotate -f crs_logs.conf") it gives me lots of errors like these two:
error: error setting owner of /u01/app/oracle/diag/crs/zvm186-g-qa-db3/crs/trace/olsnodes_18754.trm-20171211 to uid 54320 and gid 54321: Operation not permitted
error: error setting owner of /u01/app/oracle/diag/crs/zvm186-g-qa-db3/crs/trace/olsnodes_19441.trc-20171211 to uid 54320 and gid 54321: Operation not permitted
But, it seems to do most of what I want when I run it manually. Overnight though, when it runs automatically, it seems to do nothing, but it does update the: /var/lib/logrotate/logrote.status file each night with some details about every file in the log directory.
I'm an Oracle DBA, not a Linux expert. It looks to me like logrotate should be able to help me with these files, but it is not working for me yet.