Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 97175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:57:15+00:00 2026-05-10T23:57:15+00:00

How can I rotate the Apache Access and Error logs on a Window 2000

  • 0

How can I rotate the Apache Access and Error logs on a Window 2000 box?

I include my batch file below as an answer.

Is there a way of doing this directly via the Apache config file? I’m currently using the following customlog command to generate daily logs.

CustomLog ‘|’ ‘*Apache-Path/bin/rotatelogs.exe’ ‘*Apache-Path/logs/backup/internet_access_%d-%m-%y.log’ 86400′ combined

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:57:16+00:00Added an answer on May 10, 2026 at 11:57 pm

    Here’s the DOS batch file, modified as annotated. I run it weekly and it keeps 8 weeks of zipped backups. You’ll need to install 7 zip.

    I haven’t parametrised the paths, feel free to.


    @echo off  :: Name - svrlogmng.bat :: Description - Server Log File Manager :: :: History :: Date         Authory    Change :: 22-May-2005  AGButler   Original :: 14-Jan-2008  AIMackenzie Changed net stops and paths where necessary  :: ======================================================== :: setup variables and parameters :: ========================================================  :: generate date and time variables for /f 'tokens=2,3,4 delims=/ ' %%i in ('date /T') do set trdt=%%k%%j%%i for /f 'tokens=1,2 delims=: ' %%i in ('time /T') do set trtt=%%i%%j set nftu=%trdt%%trtt%  :: set the Number Of Archives To Keep set /a noatk=8  :: ======================================================== :: turn over log files :: ========================================================  :: change to the apache log file directory cd /D 'D:\Program Files\Apache Software Foundation\Apache2.2\logs\'  :: stop Apache Service, Move log files and restart Apache Service 'D:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe' -k stop  echo %nftu% >> access.log move 'D:\Program Files\Apache Software Foundation\Apache2.2\logs\access.log' 'D:\Program Files\Apache Software Foundation\Apache2.2\logs\%nftu%_access.log'  echo %nftu% >> error.log move 'D:\Program Files\Apache Software Foundation\Apache2.2\logs\error.log' 'D:\Program Files\Apache Software Foundation\Apache2.2\logs\%nftu%_error.log'  'D:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe' -k start  :: ======================================================== :: zip todays Access and Error log files, then delete old logs :: ========================================================  :: zip the files 'D:\Program Files\7-Zip\7z.exe' a -tzip %nftu%_logs.zip %nftu%_access.log %nftu%_error.log  :: del the files del /Q %nftu%_*.log  :: ======================================================== :: rotate the zip files :: ========================================================  :: make list of archive zip files type NUL > arclist.dat for /F 'tokens=1,2 delims=[] ' %%i in ('dir /B *_logs.zip ^| find /N '_logs.zip'') do echo  %%i = %%j>> arclist.dat  :: count total number of files for /F 'tokens=1 delims=' %%i in ('type arclist.dat ^| find /C '_logs.zip'') do set tnof=%%i  :: setup for and create the deletion list set /a negtk=%noatk%*-1 set /a tntd=%tnof% - %noatk%  type NUL>dellist.dat for /L %%i in (%negtk%,1,%tntd%) do find ' %%i = ' arclist.dat >> dellist.dat  :: del the old files for /F 'tokens=3 delims= ' %%i in ('find '_logs.zip' dellist.dat') do del /Q %%i  :: remove temp files del /Q arclist.dat del /Q dellist.dat 

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 188k
  • Answers 188k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you really don't want to use something sane like… May 12, 2026 at 5:32 pm
  • Editorial Team
    Editorial Team added an answer Exception thrown in a thread normally couldn't be caught in… May 12, 2026 at 5:32 pm
  • Editorial Team
    Editorial Team added an answer File a bug report to the matplotlib's developers, and ask… May 12, 2026 at 5:32 pm

Related Questions

How can I rotate the text within an HSSFCell class of Apache POI?
How can I rotate the hue of an image using GDI+'s ImageAttributes (and presumably
I was hoping someone could help me with a memory issue on the iPhone.
I have made a MDI (tabbed) application that uses PictureBoxes inside TabPages. The picturebox

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.