Showing posts with label logrotation. Show all posts
Showing posts with label logrotation. Show all posts

Saturday, October 6, 2012

Rotating weblogic stdout file

taking some notes here:
https://forums.oracle.com/forums/thread.jspa?threadID=903561
see also Oracle document ID 827438.1 "How to rotate .out ( stdout) log file in weblogic 9.2 (solaris/linux)"

Default location of the file is <domain_name>/servers/<server_name>/logs/server_name.out

The answer is "WebLogic Server cannot set this file to another location than the default. But you can use "symbolic link" on Linux OS to realize this function"

There is a script file wlscontrol.sh declaring a variable OutFile.
A consultant tried to change it but the server started in FAILED mode.

See also:

By default Weblogic wont have options to rotate the *.out file, If you are running in unix or Linux boxes, you can add the following snippet

under /etc/logrotate.conf file append a function to handle *.out files

<<Location of logs directory>>/*.out {
copytruncate
rotate
size=20Mb
}




Thursday, May 24, 2012

logrotate

Doc here http://linuxcommand.org/man_pages/logrotate8.html


find / -name logrotate 2> /dev/null

/etc/cron.daily/logrotate
/usr/sbin/logrotate



less /etc/cron.daily/logrotate

#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0



less /etc/logrotate.conf


# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
minsize 1M
create 0664 root utmp
rotate 1
}

/var/log/btmp {
missingok
monthly
minsize 1M
create 0600 root utmp
rotate 1
}

# system-specific logs may be also be configured here.


Sunday, August 21, 2011

Log file rotation

In the Managed Server configuration, Logging, "Log file name" you can assign a file name.
If you say
"logs/myserver.log"

it will generate rotated filenames like

myserver.log00001


You can insert a timestamp information in the file name.

Example:
myserver_%yyyy%_%MM%_%dd%_%hh%_%mm%.log

The documentation says:

"To include a time and date stamp in the file name when the log file is rotated, add java.text.SimpleDateFormat variables to the file name. Surround each variable with percentage (%) characters.

For example, if the file name is defined to be myserver_%yyyy%_%MM%_%dd%_%hh%_%mm%.log, the log file will be named myserver_yyyy_mm_dd_hh_mm.log.

When the log file is rotated, the rotated file name contains the date stamp. For example, if the log file is rotated for the first time on 2 April, 2003 at 10:05 AM, the log file that contains the old messages will be named myserver_2003_04_02_10_05.log00001."



If you do not include a time and date stamp, the rotated log files are numbered in order of creation. For example, myserver.log00007.

However this is slightly incorrect:
myserver_%yyyy%_%MM%_%dd%_%hh%_%mm%.log

generates a rotated log file:
myserver_2011_08_21_12_22.log

and not
myserver_2011_08_21_12_22.log00001
as the documentation says.

Anyway the "Limit number of retained files" is respected, even is the progressive number is not the extension.