WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  IHS log compression

    Posted 09/17/13 03:47 PM
    Hello All,

    I'm trying to assist a customer with automating log compression.  Currently we use the following to rotate the access logs on a daily basis. 

    CustomLog "| bin/rotatelogs.exe Logs/access.log%d-%b-%Y-%H-%M 86400" common

    I understand that compression needs to happen outside the IHS config.  I'm now hoping that someone has this automated.  I'm expecting some kind of batch script that invokes a compression tool and then a scheduled task to kick it off.  In this particular case I'm running on a Windows platform.  

    What we want then is a way to compress the logs using the following criteria:

    1. Create a zip file in an alternate location (on the same physical server)
    2. Perform a simple check to select log files based on date
         - either using the modified date OR using the file names
         - example file name -> "access.log17-Sep-2013-00-00"
    3. If log file is older then 10 days, append the file into a compressed zip file

    I don't mind if the solution is complex if it gives more flexibility - above is really just a starting point to get this discussion moving forward.

    Thanks! 


     


  • 2.  IHS log compression

    Posted 09/18/13 08:09 AM
    Hi Ryan,

      I suggest to look in this forum thread, You will find forfile command, that is very usefull in windows to find files with matching criteria:

      Historical logs for IBM HTTP Server
      www.websphereusergroup.org/go/thread/vie...

      If you have 7-zip (free and opensource)
      www.7-zip.org/
     
      To generate zip file:
     
      7z.exe a %USERPROFILE%\gabi.zip C:\WebSphere8\HTTPServer8\logs\*.log
     
      Then with forfile command find your requiered files, compress them with 7zip and delete.  
     
      forfile
      technet.microsoft.com/en-us/library/cc75...
     
      Put all of then in bat file (f.e) and the schedulle this bat file with Windows Task Scheduller.
     
      Hope this helps.
     
    regards


  • 3.  IHS log compression

    Posted 09/18/13 12:39 PM
    Thank you very much! This is exactly what I was looking for.  I'll try this out.