View previous topic :: View next topic |
Author |
Message |
megasound Guest
|
Posted: Sun Dec 21, 2008 12:51 pm Post subject: rotating log files |
|
|
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 |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12793 Location: USA
|
Posted: Sun Dec 21, 2008 1:49 pm Post subject: |
|
|
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
Quote: | 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: | @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 |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12793 Location: USA
|
Posted: Sun Dec 21, 2008 1:52 pm Post subject: |
|
|
Quote: | 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
Quote: | 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 |
|
Back to top |
|
|
megasound Guest
|
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12793 Location: USA
|
Posted: Sun Dec 21, 2008 4:07 pm Post subject: |
|
|
Quote: | 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 |
|
Back to top |
|
|
megasound Guest
|
Posted: Mon Dec 22, 2008 10:52 am Post subject: thanks |
|
|
thanksss
you answerd my question in the other forum... |
|
Back to top |
|
|
|