?
Solved

Apache Access Log File Reset

Posted on 2011-02-10
5
Medium Priority
?
309 Views
Last Modified: 2012-05-11
We have Apache v2.2 running on a Windows Server 2008 64 bit that has an access.log file that is over 6gb in size.  I want to know (in detail) how to reset the log file as well as any suggestions on how to set up a maintenance plan or configuration settings to avoid this in the future.  I am not overly proficient in Apache so please be as detailed as possible.  Thank you very much for your help.
0
Comment
Question by:mjfox1725
[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
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:DangerousJeff
ID: 34865082
Wow, 6GB log file!
OK, so you will likely want to use a tool like rotatelogs or cronolog to automatically split your log file as it gets larger.
In your Apache configuration file (httpd.conf or apache.conf ?) you'll need to find the line that mentions your access.log file that is huge.

*Before making any changes to this config, make a backup copy of this file*

For example (don't copy this litterally) you might have the following currently:
CustomLog log/access.log combined 

Open in new window


You would want to change that to (untested):
CustomLog "||C:/path/to/cronolog.exe log/%Y-%m-%d-access.log combined"

Open in new window


Take special notes of the quote marks ", the pipes |, the %Y%m%d bit to date the logs and pointing to the specific path of your log rotation tool. By default this will create a new log every day.

You should then run the check configuration tool, which should be in the start menu and then do a graceful restart of Apache for it to load this new configuration.

You can find out more here:
http://cronolog.org/usage.html
http://httpd.apache.org/docs/current/logs.html#piped

rotatelogs should be in your apache directory somewhere, or cronolog can be downloaded from:
http://cronolog.org/download/index.html
0
 

Author Comment

by:mjfox1725
ID: 34865337
This is what I have presently:
<IfModule log_config_module>
    #
    # 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

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access.log" common

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

Open in new window

0
 
LVL 4

Expert Comment

by:DangerousJeff
ID: 34865605
Yeah, so depending on where you have put your log rotation tool, change line 21 to *something* like:

CustomLog "||C:/path/to/cronolog.exe logs/%Y-%m-%d-access.log common"

Open in new window

0
 

Author Comment

by:mjfox1725
ID: 34866020
Do I just download cronolog and copy it to the server as there does not look like there is any sort of installation procedure.  Also that application looks like it si from 5+ years ago on their website.  Please confirm when you get a chance.
0
 
LVL 4

Accepted Solution

by:
DangerousJeff earned 2000 total points
ID: 34866556
Yeah its just a basic tool, you could use rotatelogs.exe instead if you prefer, it *should* be in your apache directory somewhere.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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 …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

650 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