Friday, June 26, 2009

How to Append Time to access_log file

To append the timestamp to the access_log file to identify the time a new access_log
file is created is done by adding timestamp information to the CustomLog directive.
1. Edit the httpd.conf
2. Locate the CustomLog directive
3. Add the timestamp parameters. For example:


Windows:
CustomLog "D:\oracle\portal\Apache\Apache\bin\rotatelogslogs/access_log.%Y_%m_%d_%H_%M_%S 86400" common

Unix:
CustomLog " /home/oracle/portal/Apache/Apache/bin/rotatelogs/home/oracle/portal/Apache/Apache/logs/access_log.%Y_%m_%d_%H_%M_%S 86400" common

Where:
%Y = year
%m = month
%d = day
%H = hour
%M = minute
%S = second
86400 = rotation time in seconds, every 24 hours
4. Save the file
5. Save changes to the DCM repository

dcmctl updateconfig
6. Stop and restart HTTP Server

opmnctl stopproc ias-component=HTTP_Server
opmnctl startproc ias-component=HTTP_Server

This will create an access_log file with date and time in GMT appended to it at a duration ofevery 24 hours.

No comments: