Solved

Manage Apache web server log files

Posted on 2009-03-31
2
534 Views
Last Modified: 2013-12-07
Hi there,

In this question I am looking for advice and guidance - not necessarily a single specific answer.  

I run an application hosting service, and one of the things I have noticed is that the Apache web server logs are huge.  Each month the access.log file grows by nearly 2 GB.

I am wondering if there is a way to configure the Apache logging so that the access.log file doesn't grow so big (or so fast).

In the httpd.conf file I have the following settings:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error.log

#
# LogLevel: Control the number of messages logged to the error.log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
CustomLog logs/access.log combined
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In addition, I have enabled/configured SSL, and the following settings are defined in ssl.conf:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ErrorLog logs/error_log
TransferLog logs/access.log

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
#CustomLog logs/ssl_request_log \
#          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
CustomLog logs/access.log combined
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I suspect part of my problem is I am using access.log for everything.  What should I be using?  Should I specify different log files in ssl.conf and httpd.conf?  What should the Loglevel be for a Production environment?

As part of my service to my clients I use awstats to generate nice pretty reports.  With regard to awstats, is there a "best practice" approach to dealing with either large log files or log files that are being archived/renamed?  Is there a better product than awstats?

I should mention that the environment is Windows Server 2003 with Apache 2.0.

Cheers,

Paul
0
Comment
Question by:mrgordonz
2 Comments
 
LVL 29

Accepted Solution

by:
Michael Worsham earned 500 total points
ID: 24041354
What you are looking for is called 'logrotate', however there is not a port of it for Windows Server 2003.

However, I did find these two solutions...

Poor mans logrotate for Windows
http://www.datori.org/?p=7

Apache for Win32 Log file Rotation
http://www.sprint.net.au/~terbut/usefulbox/apachelogrot.htm
0
 

Author Comment

by:mrgordonz
ID: 24076507
Hi mwecomputers,

I didn't actually use the solutions you suggested, but you did point me in the right direction.  I ended up using cronolog, along with conditional logging to manage the growth of the log files.  I also discovered that awstats can access log files that date stamps in the name with a simple config change.

Because you were the only person who offered a solution, you get the points.

Cheers,

Paul
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question