Blog Post RSS ?

Blogs » Open Source » Logging with Cronolog
 

Logging with Cronolog

by Blane Warrene

I have been experimenting with Cronolog, developed by Andrew Ford, who also authored the Apache Pocket Reference, published by O’Reilly and Associates.

I elected to work with cronolog based on a recommendation from a peer and the fact that the log files for the site in question were unmanageable in size. You may remember it being briefly mentioned at the end of my column on Apache web logs.

This handy program allows for logs to be broken down by day, month and year. I chose a middle ground and have them set to rotate to new logs on the first of each month.

Installation is very easy. After downloading and unpacking — simply use ./configure and make to build the executable. You can then copy src/cronolog to where you want to call it from. I used /usr/local/sbin/cronolog.

Usage is fairly straightforward as well. I noted a snippet from my httpd.conf below to show how it integrates into the Apache log config inside of virtual servers.





CustomLog “|/usr/local/sbin/cronolog /home/domains/mydomain.com/logs/%Y/%m/access_log” combined
ErrorLog “|/usr/local/sbin/cronolog /home/domains/mydomain.com/logs/%Y/%m/error_log”


The cronolog program is called and reads log message input and manages the log file, also conveniently creating a folder hierarchy in your logs folder by month and year as it creates each month’s new log file.

Now my logs folder looks like this:

logs/
2004/

Within the 2004 directory I see 07 and 08 directories for July and August, each that contain an access_log and error_log for the month.

A final note — the Cronolog credits Klaus Mueller with creating a Windows binary for cronolog to run on Windows systems. The download is here.

This post has 2 responses so far

  1. Very nifty indeed.

    Thanks.

     
  2. FYI. Seems the windows binary is not for Apache 2. Don’t know if there is one for Apache 2

     

Sponsored Links

Leave a response

You are not logged in, log in with your SitePoint Forum username and password.

-OR- Post Anonymously

* Make sure any code samples are escaped (i.e. ‘<b>’ becomes ‘&lt;b&gt;’).

If not logged in, your comments will be placed in a moderation queue. This means your comment may not appear until one of our moderators approves it.

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.