rotating log files

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
megasound

rotating log files

Post by megasound »

hi all
i changed the logging level to : save all info
but as you know this will result in a big logfile

is it possible to config the software that it will be
rotating the logfile after 30Mb (or so) and then move that "old" logfile
to a dedicated directory and rename it to log<date>.htm

is it possible to add the date to the logfile name ?

for example:

c:\hostmonitor\log.htm............................current log
c:\hostmonitor\oldlogs\log21122008.htm...rotated log file

under option -> logprocessing this is NOT working
cmd /c move /y "%log%" "%logpath%oldlog\%dd%-%mm%-%yy%-%logname%"


many thanks in advance
menno
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Sure, you can.
Please check the manual. Printable manual in MS Word format located in the folder where HostMonitor is installed.
Please check the following sections:
- Options dialog -> Log settings -> File log
- Options dialog -> Log processing
or simply start HostMonitor, click Options menu, go to Log setting -> Log Processing page and click Help
is it possible to add the date to the logfile name ?
for example:
c:\hostmonitor\log.htm............................current log
c:\hostmonitor\oldlogs\log21122008.htm...rotated log file
Its much more easier to setup HostMonitor to use date variables for current log file. Just specify file name like C:\Program Files\HostMon\Logs\log%mmyyyy%.htm

However you can use static name for log file and then rename it using current date. For such purpose you need script file (BAT) file that will retrieve current date.
Something like this

Code: Select all

@echo off
REM Script retrieves system date and parse it.
REM Output variables:
REM %Year%, %Month%, %Day%
REM %iDate%,%sDate% - Date Separators from registry

rem Select date
:: Export registry's date format settings to a temporary file
START /W REGEDIT /E _TEMP.REG "HKEY_CURRENT_USER\Control Panel\International"

:: Read the exported data
FOR /F "tokens=2* delims==" %%A IN ('TYPE _TEMP.REG ^| FIND /I "iDate"') DO SET iDate=%%A
FOR /F "tokens=2* delims==" %%A IN ('TYPE _TEMP.REG ^| FIND /I "sDate"') DO SET sDate=%%A
DEL _TEMP.REG

SET iDate=%iDate:"=%
SET sDate=%sDate:"=%

IF %iDate%==0 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ('DATE/T') DO (
SET Year=%%C
SET Month=%%A
SET Day=%%B
)
IF %iDate%==1 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ('DATE/T') DO (
SET Year=%%C
SET Month=%%B
SET Day=%%A
)
IF %iDate%==2 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ('DATE/T') DO (
SET Year=%%A
SET Month=%%B
SET Day=%%C
)

:: Remove the day of week if applicable
FOR %%A IN (%Year%)  DO SET Year=%%A
FOR %%A IN (%Month%) DO SET Month=%%A
FOR %%A IN (%Day%)   DO SET Day=%%A

REM move and rename log file
MOVE /y log.htm oldlogs\log%day%%month%%year%.htm
Regards
Alex
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

under option -> logprocessing this is NOT working
cmd /c move /y "%log%" "%logpath%oldlog\%dd%-%mm%-%yy%-%logname%"
That's because you are trying to use variables that are not suported here
Quote from the manual
Execute command:
You may specify 2 commands for execution: one for common log files, another for private logs. You may use special variables in the command line: %log% - represents full name (including path) of the log file (e.g. C:\Program Files\HostMonitor\Logs\04-2004.htm)
%logpath% - represents path to the log file (including trailing back slash. E.g. C:\Program Files\HostMonitor\Logs\)
%logname% - represents name of the log file (e.g. 04-2002.htm)
%logext% - represents extension of the log file (e.g. ".htm")
Regards
Alex
megasound

thanks

Post by megasound »

thanks for the help so far

i saw also this option...so i tried that function
but stil this is not working.... :(

http://www.ks-soft.net/cgi-bin/phpBB/vi ... php?t=5029

many thanks so far for all the help to everybody !!!

menno
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

i saw also this option...so i tried that function
but stil this is not working....
Could you please explain what exactly is not working?

Regards
Alex
megasound

thanks

Post by megasound »

thanksss
you answerd my question in the other forum...
Post Reply