Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rolling over log file 2

Status
Not open for further replies.

pchechile

IS-IT--Management
Jan 9, 2002
2
US
Is there any way to have WebSphere start new log files depending on size, date, etc. Our log files grow pretty quickly. I need to stop the app so we can rename the standard output file and move it to a different location every couple days. Is there any way to have websphere rename and start a new standard output log? Any help on this is much appriciated.

Thanks you.
Pete
 
I have not any any Websphere tools to achieve that.
We have scripts that run daily to achive backup.
Dont see a reason for you to stop the app to do it.

example shell

#!/bin/sh

DATE=`date +%m%d`
LOGDIR=/appl/logs
APPNAME=hell

### Make MMDD directory under archive directory
mkdir -p ${LOGDIR}/${APPNAME}/archive/${DATE}
chmod 755 ${LOGDIR}/${APPNAME}/archive
chmod 755 ${LOGDIR}/${APPNAME}/archive/${DATE}

### Copy logs to archive directory
cp ${LOGDIR}/${APPNAME}/stderr.log ${LOGDIR}/${APPNAME}/archive/${DATE}/${DATE}.
stderr.log
cp ${LOGDIR}/${APPNAME}/stdout.log ${LOGDIR}/${APPNAME}/archive/${DATE}/${DATE}.
stdout.log

chmod 644 ${LOGDIR}/${APPNAME}/archive/${DATE}/*.log

### Reset Log Files
cat /dev/null > ${LOGDIR}/${APPNAME}/stderr.log
cat /dev/null > ${LOGDIR}/${APPNAME}/stdout.log
 
Thanks for the responce. I need to stop the app so the file lock is removed so I can move it to another (larger) drive. The idea is not to just back it up, but to free disk space on the drive that the app server is running on.
 
I have found that you can move the file within the same filesystem. Even though it has a different name, or it is in a different directory, the i-node to the file is the same so logging still is sent to that file.

For us that isn't a big problem because we are using WAS 3.5.2 which has a memory leak. We are forced to reboot the server at least each week. So in the shutdown script, I do maintenance on the log files, and then when the system comes back, it is using the new logs.

I don't know for WAS 4.0. With rate that the logs fill up, you would think that IBM would create some utility to roll the logs without bringing down WAS. If so, I'd love to know about it.
Einstein47
(Love is like PI - irrational, unending, and very important.)
 
Okay - I have to correct what I said previously. Using the cp command as hs5233 does will avoid the lock problem, and "cat"ing a null into the file with "cat /dev/null > file" will clean out the logs without loosing the locks.

IBM doesn't need a utility if a simple cp and cat can do the trick. Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Hi pchechile,

Did you get any solution for large log file on websphere.
We are also facing same problem and we would really like to have datewise log file.

Yogesh.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top