What to do about the ever growing files on Oracle Application Server as:
default-web-access.log
server.log

and more..

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:

———-//—————-

/software/oracle/product/10.2/middle/j2ee/home/log/home_default_island_1/*.log {
daily
compress
delaycompress
dateext
maxage 30
rotate 7
size=+1024k
notifempty
missingok
copytruncate
}

———-//———–

(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:

/oracle/db/admin/*/adump/*aud /oracle/db/admin/*/bdump/*trc /oracle/db/admin/*/udump/*trc /oracle/db/admin/*/cdump/core_[0-9]* {
daily
compress
delaycompress
dateext
maxage 30
rotate 7
size=+1024k
notifempty
missingok
copytruncate
}

———————————
Explenation of the parameters (only for the ones that are mentioned above):

Source:  http://linux.die.net/man/8/logrotate

compress
Old versions of log files are compressed with gzip by default.

copytruncate
Truncate the original log file in place after creating a copy, instead of moving the old log file and optionally creating a new one, It can be used when some program can not be told to close its logfile and thus might continue writing (appending) to the previous log file forever. Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost. When this option is used, the create option will have no effect, as the old log file stays in place.

daily
Log files are rotated every day.

dateext
Archive old versions of log files adding a daily extension like YYYYMMDD instead of simply adding a number.

delaycompress
Postpone compression of the previous log file to the next rotation cycle. This has only effect when used in combination with compress. It can be used when some program can not be told to close its logfile and thus might continue writing to the previous log file for some time.

maxage count
Remove rotated logs older than <count> days. The age is only checked if the logfile is to be rotated. The files are mailed to the configured address if maillast and mail are configured.

missingok
If the log file is missing, go on to the next one without issuing an error message. See also nomissingok.

notifempty
Do not rotate the log if it is empty (this overrides the ifempty option).

rotate count
Log files are rotated <count> times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather then rotated.

size size
Log files are rotated when they grow bigger then size bytes. If size is followed by M, the size if assumed to be in megabytes. If the k is used, the size is in kilobytes. So size 100, size 100k, and size 100M are all valid.

Nice addition on this page, read this slowly…:
“Log files are rotated if the current weekday is less then the weekday of the last rotation or if more then a week has passed since the last rotation. This is normally the same as rotating logs on the first day of the week, but it works better if logrotate is not run every night.”