0? What about status of the test?However, it always replies ‘0’ even when “service stopped” message is in the log file. Could you please let me know what I am doing wrong?
Regards
Alex
30 MB is a bit big file. It is hard to parse such huge file.raphaelb wrote:Some of the files that need to be monitored are up to 30 MB. When the log file is that big, the test can still take a long time to complete.
Utility starts from the begin of file each time the test performed.raphaelb wrote:Does the utility audit the whole file at each test or does it start from the last line it has read during the previous test?
Code: Select all
@echo off
rem %1 - Filename full path
rem %2 - Bad pattern string
rem %3 - Good pattern string
rem %4 - filename to store last line number
set last_pattern_status=Ok
set last_pattern_line=
set last_line_number=1
set line_iterator=0
IF EXIST %4 (
for /f "usebackq eol=; tokens=*" %%i in (%4) do SET last_line_number=%%i
)
rem Step 1: Retrieving line
for /f "eol= tokens=* skip=%last_line_number%" %%i in (%1) do (
echo "%%i" | find "%~2" > NUL
IF NOT ERRORLEVEL 1 (
set last_pattern_status=Bad
set last_pattern_line=FAILURE
)
echo "%%i" | find "%~3" > NUL
IF NOT ERRORLEVEL 1 (
set last_pattern_status=Ok
set last_pattern_line=SUCCESS
)
set /A line_iterator=line_iterator + 1
)
set /A last_line_number=last_line_number+line_iterator
echo %last_line_number% > %4
echo ScriptRes:%last_pattern_status%:%last_pattern_line%
Yes, it is possible, you just should change the last line of the script with the following one:raphaelb wrote:Would it be possible to take into account the last line number read in the utility as well? i.e. if reply field gets 2 variables (“line number of the last message” concatenated with “last line read number”)
Sorry, I do not think it is possible.raphaelb wrote:would it be possible to use the second one to start reading at this line of the file?