// you’re reading...

Best practice

Taming Logfiles


In recent RedDot releases* a little defect (#25320) is found which prevents you from automatically deleting Log-Files being older than n days. As I don’t want to kill all log files at once (keeping evidence always comes in handy for administrators), I found a nice workaround with standard Windows Server features.

The nice command line tool forfiles is shipped with Windows Server 2003 and Windows Server 2005, which allows to select files for an operation by date. The following script deletes the high traffic log files (Asyncronous Queue, Common Logs, Publishing Logs and Content Class Sharing Logs) being older than 30 days, all other log files are deleted if they are older than half a year.

@echo off
:: Delete high traffic log folders (All logs > 30 days)
forfiles /P <Path to RedDot>ASPLOGAsyncQueue /D -30 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGCommon /D -30 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGPublishing /D -30 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGShared /D -30 /C “cmd /c del @fname.@ext /q”

:: Delete normal traffic log folders (All logs > 1/2 year)
forfiles /P <Path to RedDot>ASPLOGApplicationImport /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGChangeLicense /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGExport /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGImport /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGInstall /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGLogin /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGNavigation /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGServerjobs /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGTreeExport /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGUpdateDatabase /D -182 /C “cmd /c del @fname.@ext /q”
forfiles /P <Path to RedDot>ASPLOGUser /D -182 /C “cmd /c del @fname.@ext /q”

Save this script as a batch file on your CMS server and create a scheduled task which runs every night. If no files match the criteria, the Errorlevel returned is 1 – so don’t worry, the script is running fine.

* This bug occurs in RedDot versions up to 7.5.2.17 but will be fixed in 7.5.2.2 according to the German RedDot support. Thanks for the information!

Share and Enjoy:
  • Print
  • email
  • Twitter
  • Digg
  • Reddit
  • StumbleUpon
  • Google Bookmarks
  • del.icio.us
  • MisterWong
  • Facebook
  • LinkedIn

No related posts.

About the author:

Frederic Hemberger Frederic Hemberger lives in Cologne, Germany where he works as a technical consultant and senior RedDot developer. After years of studying the ancient and mysterious ways of content management, he acquired the black belt of RedDot-fu. After teaching many students in the weird ways of the Dot, he retreated to the old misty mountains to meditate. Legends tell that he finally reached the mysterious state of IoRangeNoRedDotMode.

Discussion

One comment for “Taming Logfiles”

  1. Cool – that removes one of my RedDot blog entries I need to port across to here: Removing old RedDot CMS log and temporary files

    Posted by Adrian Mateljan | December 4, 2008, 2:38 pm

Post a comment



Stay up to date! - Get notified about followup comments

If you don't feel the urge to comment but wish to stay in the loop:
Just enter your email and subscribe to new comments.

Subscribe without commenting

Recent Tweets

  • RT @AirKraft: Transport Canada breakout: they manage 80K pages and 300K assets with WSM(RedDot). Wow! #OTCW 2010-11-11
  • The RedDot usergroup session 'Future of WCM' is in National Harbor 7, now. See you there! #otcw 2010-11-11
  • RT @yttergren: @AirKraft: Calling all WSM(RedDot) devs: share your solutions on http://bit.ly/bgPIof EVERY solution can win an iPad #OTCW 2010-11-10
  • Come to the Solution Exchange session. Enhance your (#reddot) CMS project! Chesapeake 12, 3:20pm #otcw Looking forward to see you there! 2010-11-10
  • More updates...