?
Solved

Manage Apache web server log files

Posted on 2009-03-31
2
Medium Priority
?
549 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 1500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
Now many of you may wonder how you can reach great design with least number of essentials. Isn’t stuffing ‘more and more number of elements that speak for the purpose’ the right way to do it? Erm, not always, and in this write-up, you will see why.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

569 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