Edited by Foxit PDF Editor Copyright (c) by Foxit Software Company, 2004 - 2007 For Evaluation Only. WebSphere Environment Log Management In a websphere environment, there will be multiple log files for your application servers, http servers etc. If we do not have rotation or automation in place, these logs can grow in large size and occupy more space and in some cases may create disturb the normal operations as well. Recently, someone mailed me about IBM http server failing to start without writing anything to log files; they also mentioned that they have enough space on the disk for the log files to write. I suggested them to change the logging a higher detail levels and see if anything shows up in the logs. Finally, the issue is with the http_plugin.log file which has grown beyond 2GB [max file limit, on their machine]. Until the issue is resolved, the web server is down. Another important point is that, the log file size will impact the performance of your servers, as the larger files take more system resources. Similar things can happen with your websphere application server as well. So, how can we avoid such situations? The solution is log management or in simple terms, regular maintenance on log files. As a part of this log management, you will be rotating the log files and archive the older logs. Before start implementing the log management, we need to have the list of log files to manage and a policy to manage them. Server Log file name Options Websphere SystemOut.log In-built feature to rotate logs based on application server & SystemErr.log size and time Trace.log In-built feature to rotate logs based on size Activity.log No in-built feature IBM http server Access.log & In-built feature to rotate logs based on error.log size and time Websphere plug-in Plug-in log No in-built feature
In websphere application server, for native logs, core files and service log there is no in-built feature for rotating log files. In Http server, there is no option to rotate the plug-in log file. If in-built options are not available to rotate a log, we are going to implement it using scripts and other OS level features. Now you’ve list of the log files, which needs maintenance. So its time to prepare a strategy for their maintenance. This is simply answering 2 questions. 1. When do you want to rotate log files [size or time] 2. How many log files you want to keep
A. WebSphere Application Server A.1 JVM logs [SystemOut and SystemErr] You can set the log rotation options for these files from the administration console. Navigate to Troubleshooting logs and trace server name jvm logs .
Choose file size or time under log file rotation option and save the changes. The log files are rotated automatically based on your option. The old log file will be named as SystemOut_yy.mm.dd_hh.mm.ss.log / SystemErr_yy.mm.dd_hh.mm.ss.log. You can also specify how many old log files you want to retain. In the above example [screenshot], logs will be rotated when they reach 50MB and 50 old logs will be retailed.
A.2 Trace Log If you enabled the tracing, the trace log can be rotated based upon its size. Also you can mention the maximum number of historical files.
A.3 Service Log This is the service log otherwise known as activity log which can be read using log analyzer tool, to display events to analyze problems based on symptom database. You have an option to specify the maximum file size but it will not be rotated when it reaches the maximum defined size. When the max size is reached, it wraps in place.
B. IBM http server [access.log and error.log] To implement the rotation of the log files for IBM http server, you can use the rotatelogs utility which can be found under bin directory of your http server installation. Using this, you can rotate the log files based on size, time. Check here for more details. Using the piped logging option, we can directly use rotatelogs utility in our virtualhosts definitions. Here is an example of entries for this implementation. <virtualhost> … # Rotates access log every 24 hours. CustomLog "|/usr/IBM/httpserver/bin/rotatelogs /usr/IBM/httpserver/logs/vhost1_access.log 86400" common
# Rotates errror log when it reaches 50M ErrorLog "|/usr/IBM/httpserver/bin/rotatelogs /usr/IBM/httpserver/logs/vhost1_error.log 50M"
</virtualhost> Note: while using this utility, always provide the full path to the rotatelogs executable and log file location. C. Websphere plug-in log [http_plugin.log] It is advisable to keep this files logging at ERROR level. This can be specified in the plugin configuration file [plugin-cfg.xml]. Look for the following line in the plugin config file and edit it accordingly to specify the logging level and log file location. <Log LogLevel="Error" Name="/opt/WebSphere/Plugins/logs/webserver1/http_plugin.log"/>
Since there is no in-built support to rotate this log, use the following unix commands to rotate the log. Write a small script to do the following 3 steps. 1. Goto the directory where the plugin log is present Cd /opt/IBM/HTTPServer/Plugins/logs/webserver1 2. Copy the plugin log to a new file with date Cp http_plugin.log http_plugin_log.’date +%Y-%m-%d’ 3. Now purge the old log file Cat /dev/nul >http_plugin.log Once the script is made, place the script in crontab, to run it at a specified time.