What to do about the ever growing files on Oracle Application Server as:
These files are not logrotated (at least in the ‘older versions’ of OAS) and cannot always be deleted or renamed manually on a ‘normal’ way (I know, there is a way..), and it must be scripted to avoid extraordinary large log-files.
Quite annoying, until Frits Hoogland pointed me at a standard Linux-functionality, ‘logrotate’.
For example, to logrotate the files default-web-acces.log and server.log in the directory $ORACLE_HOME/j2ee/home/log/home_default_island_1, create a script like this:
(an explenation of these parameters follows at the bottom of this post, pay special attention to ‘copytruncate’, which is very suitable for several files of the application server.)
This script should be (on Linux) in /etc/logrotate.d/ (as root). Call it ‘ora_logrotate’ for example.
The Linux-program ‘logrotate’ is daily executed (from /etc/cron.daily/) and will run the scripts in /etc/logratate.d .
You can test this manually by running it like ‘/etc/cron.daily/logrotate ora_logrotate’. The file ora_logrotate will be executed when it is place in /etc/logrotate.d .
When there is a standardised environment you can also make a script like this: