Tech News

Rotate Abyss Web Server Logs By Month

Here's how to automatically rotate Abyss web server logs by month in 32-bit Windows.

Assumptions:

  1. The Abyss web server log file is in C:\Program Files\Abyss Web Server\log\access.log.
  2. Windows has a yyyy/mm/dd date format from its Date and Time Control Panel applet.
  3. Windows has a fully functioning Task Scheduler (all related services are running).

Steps:

  1. Create a batch file with the following contents.

    for /f "tokens=1-3 delims=/ " %%a in ("%DATE%") do (
    set yyyy=%%a
    set mm=%%b
    set dd=%%c)
    
    rem the order of %%a, %%b and %%c are system dependent! (control-panel, date/time settings)
    
    echo %dd%
    echo %mm%
    echo %yyyy%
    
    if not exist "ac%yyyy%%mm%.log" (
    net stop AbyssWebServer
    rem (move the log file in another folder, example: access.22.11.2005.log)
    ren "access.log" "ac%yyyy%%mm%.log"
    rem (Abyss start and create a new log file)
    net start AbyssWebServer
    )
    pause
  2. Create a multiple time scheduled task (or make it run daily) to run the above batch file.
  3. Test the damn thing and smile to the world around you to make it a little better.
  4. For more insights, set your scopes to http://www.aprelium.com/forum/viewtopic.php?p=71723#71723
Syndicate content