Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
README.txt | 2015-04-09 | 5.2 kB | |
LogArch_1.1.zip | 2013-10-28 | 3.1 MB | |
Totals: 2 Items | 3.2 MB | 0 |
-------------------------------------------------------------------------------- LogArch v1.1 -------------------------------------------------------------------------------- LogArch is an utility allowing to archive log files produced by enterprise server applications. A typical example is a java enterprise web application, involving http server, web-services processing, database jobs and utilizing log4j library. Most applications cut log files by time intervals or by maximum size to prevent infinite growing then add some suffix to file name. This process is called log rolling and causes producing a series of files like this: logs/server.log2000-01-01 logs/server.log2000-01-02 ... or cut by hour: apache-app/log/apache-requests.log2000-01-01-22 apache-app/log/apache-requests.log2000-01-01-23 ... or cut by size: some-app/logs/client.log1 some-app/logs/client.log2 some-app/logs/client.log3 ... Theese files require much space to store and most users use scripts to delete or compress them as they are highly redundant. LogArch does exactly this allowing to analyze date suffix and group files using it as a key. An extracted suffix could be added to archive name to group files by application and date. Modern archivers like WinRar and 7-Zip usually achieve high compression rates for text files allowing to store log records history with almost no extra space. -------------------------------------------------------------------------------- Installation -------------------------------------------------------------------------------- * Install Java SE runtime (java 6, 7, 8 or later) * Install archiver software (ex.Winrar) * Unpack LogArch_1.1.zip into desired installation directory Installation directory should now contain the following subdirectories: * lib * log * etc LogArch.jar is a main executable file Settings.cfg is a default configuration file example -------------------------------------------------------------------------------- Configuring LogArch for your application -------------------------------------------------------------------------------- Edit example Settings.cfg file supplied (this example could be later restored by running LogArch with --get-settings key). Configuration file is case-sensitive JSON file. Be careful not to change file syntax or application will refuse to load it. First check WinrarPath parameter, it should point to Winrar.exe executable: "WinrarPath": "c:\\Program files\\Winrar\\Winrar.exe" Backslashes are used as escape symbols so should be doubled. Now configure archive file creation jobs in "ArchiveJobs" array. Each job produces an archive file as an output and needs the following basic parameters to be specified: "FilesPathSource" should point to a directory where your external application stores logs. "logNames" is an array that stores file names. The name could include variable date suffix, that will be parsed by LogArch. NOTE: This version (v1.1) supports only date suffix, which goes after file name. Suffix format could be configured with "DateFormatForLogFiles" parameter: "DateFormatForLogFiles": "yyyy-MM-dd-hhmmss" In order to keep some most recent files uncompressed specify number of days in "ArchiveOlderThan" parameter. The name of resulting archive should be set in "ArchiveFilePath" parameter: "ArchiveFilePath": "d:\\my_running_system\\my-logs-<DATE>-arch.rar" A name or path of archive file may contain variable date suffix marked with <DATE> tag. Date format for the arhive file name suffix could be configured with the following parameter: "DateFormatForLogFiles": "yyyy-MM-dd.hh" This parameter also sets grouping. This example shows setting for creating separate archives for log files which are changed every hour or more frequently. Grouping is supported by every minute/hour/day/month/year but not every 2, 3, etc. minutes/hour/days/months/years. Configuring the built-in scheduler is optional and will be described in next revisions. By default built-in scheduler is disabled by setting "StartScheduler" parameter to false: "StartScheduler": false -------------------------------------------------------------------------------- Running LogArch -------------------------------------------------------------------------------- Basic command to start application is presented below: java -jar LogArch.jar --settings Settings.cfg LogArch will read the configuration file specified, check "FilesPathSource" directories for files matching "logNames" filter and not within "ArchiveOlderThan" days interval. The archiver with the appropriate command line will be started to create an archive file if any uncompressed/undeleted are found during this check. If the built-in sheduler is not activated application will exit after the archiver ends job. The default configuration tells the archiver to test archive and delete log files if the test passes. To stop the application running in scheduler mode use: java -jar LogArch.jar --stop