Friday, January 9, 2015

IHS Log Rotation

This topic is about how to rotate the log , means how to generate a new log day by day with file size 5MB.


Making IBM HTTP Server Logs Rotates/Rolls Dialy


IBM HTTP Server has many Logs for it under Folder "<Installation_Directory>/IBM/HTTPServer/logs", sometimes those logs take much more time to open if they were too large and logged many data, you can customize those log files , we can say that defaults log in IBM HTTP Server are:


image
  1. Admin Log : admin_access.log
  2. Admin Error Log : admin_error.log.
  3. Access Log : access_log.
  4. Error Log : error_log.
In This tutorial we well represent how to make "Access log and Error Log" Rolling By Day and by Size :
Note : This tutorial in IBM HTTP Server v8.5 and Red hat Linux , take care when implementing it on other OS's

Steps in Appending the Logs it seems Like Apache Http Server :


  1. Locate IBM HTTP Server in <Installation_DIR>/IBMHTTPServer/conf in Your Operating System, to edit the configuration.
  2. Then Open httpd.conf.

    image


     
  3. Locate the line : CustomLog log/access_log common.
  4. Comment the line, after this line type :

    CommonLog "|/opt/IBM/HTTPServer/bin/rotatelog -l /opt/IBM/HTTPServer/log/access_log.%Y.%m.%d 5M" common
    Where"y"represents Year, "m" for month, "d" for date and "5M" for 5MB files size.
    image

     
  5. Locate the Line : ErrorLog log/error_log.
  6. Comement the Line and press enter and Enter the Code Below instead the current one :

    ErrorLog "|/opt/IBM/HTTPServer/bin/rotatelog -l /opt/IBM/HTTPServer/log/error_log.%Y.%m.%d 5M"

    image

     
  7. Then Restart IBM HTTP Server .
  8. Type the URL  for the Host for IBM HTTP Server from Browser and you can see the access log is logging by the Current date.

    image

For Every 5 minutes an new log will be generated and the old log will be saved as above 

References :

rotatelogs - Piped logging program to rotate Apache logs  is a simple program for use in conjunction with Apache's piped logfile feature. It supports rotation based on a time interval or maximum size of the log

No comments:

Post a Comment