?
Solved

Manage Apache web server log files

Posted on 2009-03-31
2
Medium Priority
?
537 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
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…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

777 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