Solved

Manage Apache web server log files

Posted on 2009-03-31
2
516 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 W earned 500 total points
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now