Solved

Manage Apache web server log files

Posted on 2009-03-31
2
535 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 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

730 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