HOME | SITEMAP | SUPPORT | FAQs
DOMAIN MANAGE/BACKROOM | BILLING
4Domains Web Hosting and Domain Registration
Account Login   WebMail   Live Chat

Web Hosting

Domain Names

Domain Auction

Solutions

Home > Support > Serverhelp > Webserver > Logs > Rotate

Rotating Your Web Server Log Files

There are several methods you can use to rotate your Web Server Log Files.

cronolog

The cronolog program reads log messages from its input and writes them to a set of output files, the names of which are constructed using template and the current date and time. The template uses the same format specifiers as the UNIX date command (which are the same as the standard C strftime library function).

Installation

To install cronolog, connect to your Virtual Server via Telnet or SSH and run the command below that matches your Virtual Server O/S.

FreeBSD
% vinstall cronolog

BSD/OS
unavailable

NOTE: If your Virtual Server was ordered after Nov 22, 1999, you are likely running FreeBSD. To find out which O/S your Virtual Server is running, use the uname command:

% uname

If your Virtual Server is not already running FreeBSD, Upgrade to a New FreeBSD Virtual Server today!

Rotating Log Files

cronolog is intended to be used in your Virtual Server web server configuration file (~/www/conf/httpd.conf) to split the access log file, or other log files, into daily or monthly log files, like in the following example.

TransferLog "|/usr/local/cronolog/cronolog /www/logs/%Y/%m/%d/access.log"
ErrorLog    "|/usr/local/cronolog/cronolog /www/logs/%Y/%m/%d/errors.log"

The sample configuration directives above instruct Apache to pipe its access and error log messages into separate copies of cronolog, which would create new log files each day in a directory hierarchy structured by date, i.e. on 31 December 1996 messages would be written to the following files.

~/www/logs/1996/12/31/access.log
~/www/logs/1996/12/31/errors.log

After midnight the following filenames would be written, with the directories 1997, 1997/01 and 1997/01/01 being created if they did not already exist.

~/www/logs/1997/01/01/access.log
~/www/logs/1997/01/01/errors.log

rotatelogs

Basically, rotatelogs is a wrapper that you include in the Log definitions in your web server configuration file (~/www/conf/httpd.conf).

NOTE: rotatelogs is not yet supported on our Virtual Servers running the FreeBSD O/S. If your Virtual Server was ordered after Nov 22, 1999, you are likely running FreeBSD. To find out which O/S your Virtual Server is running, use the uname command:

% uname

Installation

In order to use the rotatelogs wrapper you must copy rotatelogs onto your Virtual Server. To do this, connect to your Virtual Server via Telnet or SSH and execute the following command.

% cp /usr/local/bin/rotatelogs ~/usr/local/bin

Rotating Log Files

For example, to rotate your web server access log, you might include something like the following in your web server configuration file (~/www/conf/httpd.conf).

TransferLog "|/usr/local/bin/rotatelogs /www/logs/access_log 86400"

This creates the files ~/www/logs/access_log.nnnn where nnnn is the system time at which the log starts (system time is the number of seconds that have elapsed since January 1, 1970). At the end of each rotation time (here after 24 hours) a new log is started.

You can rotate the other web server log files as well.

AgentLog "|/usr/local/bin/rotatelogs /www/logs/agent_log 86400"    
RefererLog "|/usr/local/bin/rotatelogs /www/logs/referer_log 86400"
ErrorLog "|/usr/local/bin/rotatelogs /www/logs/error_log 86400"


Why Us? | About | Contact Us
Knowledge Base | Support Request
Expired Domains | Domain Name Auctions | VPS Directory | DNS Tools
Hosting Terms | Domain Terms | Privacy Policy
Copyright © 2008 - 4Domains.com, Inc.


web hostinghostingdomaindomain namedomain namescheap web hostingecommerce website designdomain registration

Web Monitoring | SEO Technology | Hacker Scanner | DNS Tools | Online Backup