search in a folder

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
Genesis
Posts: 3
Joined: Thu Aug 27, 2009 12:54 am

search in a folder

Post by Genesis »

Hello,

I have 1 log folder.
In this Folder I want that the Hostmonitor looks in every log file. But the log files have different Filenames like xx_xx_xx_001.log or yy_003.log
Can the Hostmonitor check all log files in this Folder and search for a sting (error, failed…)?
And if he find a string can he send me an E-Mail with the log file as attachment?

Hostmonitor version 6.54

Thanks

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

Post by KS-Soft »

Single Text Log or Compare Files test item may check just 1 file. Are you sure you need to check all files? May be you need to check just newest file?

Regards
Alex
Genesis
Posts: 3
Joined: Thu Aug 27, 2009 12:54 am

Post by Genesis »

Yes I must check all files in this folder. Every day at 19:00 o'clock the contents are emptied. One day there is only 1 log in it but the next day these can maybe 20 log files and another there is no one in the Folder it’s not regular.

Thanks

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

Post by KS-Soft »

Then you need to create script that will check files one by one and use Shell Script test method to run the script
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell

Something like
====================
@echo off
for %%i in (c:\targetfolder\*.log) do (
find /c "searchstring" %%i
if not errorlevel 1 (
echo scriptres:Bad:%%i
exit
)
)

====================

Script returns name of the file that contains specified string (1st of such files) so you may use %Reply% variable as parameter of the action to show name of the file.

Regards
Alex
Post Reply