Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript Logic Missing - Looking for Help to read remote text file which has current date in a log 1

Status
Not open for further replies.

Hun9865

Technical User
Oct 23, 2012
23
0
0
GB
Hello Scripting Experts,

I have an application which will write below log file automatically with the name of “CoreAPP.txt“
my Sample of “CoreAPP.txt“:


Code:
[10/31/2012 19:53:41:889 SWAP INF] {hap=CB2:app=Internet Explorer_b1 6.0.3790.3959:tid=22C0:usr=B9D327}
Elapsed time for upload: 0.718 seconds


[10/31/2012 19:53:42:639 SWAP INF] {hap=CB2:app=Internet Explorer_b1 6.0.3790.3959:tid=22C0:usr=V9V327}
Elapsed time for launch: 3.250 seconds


[10/31/2012 19:56:37:815 ???? INF] {tid=4004:usr=V47235}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[10/31/2012 19:56:37:846 ???? INF] {tid=4004}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A



[10/31/2012 10:45:00:576 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://SRVW23E:554/V1321_BDP_V1_R1_SB/V1321_BDP_C1_P2PM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[10/31/2012 00:29:59:843 OSDF ERR] {tid=1464}
The Application Virtualization Client could not parse the OSD file 'C:\SoftCache\SoftGrid Client\OSD Cache\edCc4305-3f6C-4dcc-3d70-404eb8bd97d8.osd'. Reason: XML parsing failure (rc 00000A25-00000002)

[10/31/2012 08:24:35:869 ???? ERR] {tid=336C:usr=t405230}
corrupt cp file detected ('V:\V1321_BDP\osguard.cp'). osguard cp file, NO CORRECTIVE ACTION TAKEN


[10/31/2012 22:16:39:240 JGSW ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The Application Virtualization Client could not connect to stream URL 'RTSP://PSWQAPP1:554/V14678993_BDP_C15_E2AM_SS/V14678993_BDP_C15_E2AM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[10/31/2012 22:16:39:240 SWAP ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The client was unable to connect to an Application Virtualization Server (rc 1690900A-00002002)


[10/31/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The specified application name (Application Integration) is ambiguous. Some potential matches:
Application Integration 7.0.1756.1756
Application Integration 9.2.2373.2373


[10/31/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The Application Virtualization Client cannot open Application Integration

[10/31/2012 00:03:14:313 SWAP WRN] {tid=507C:usr=N28712}
Could not load OSD file \\PSWQAPP1\Content\D1311_bDP_Adobe_Reader_9.3.3\D1311_bDP_Adobe_Reader 9.3.3.osd


[10/31/2012 00:03:14:313 AMGR INF] {tid=507C:usr=i435145}
The app manager could not create an application from '\\PSWQAPP1\Content\D1311_bDP_Adob_dobe_Reader_9.3.3\D1311_bDP_Adob_b_Adobe Reader 9.3.3.osd' (rc 0C405664-00000002).


====
[10/31/2012 13:35:16:987 JGSW ERR] {hap=1:app=Abaculus 1.0.0.1:tid=14C8:usr=R3R7DF42}
The Application Virtualization Client could not connect to stream URL 'RTSP:%SFT_SRV%:554/D1311_bDP_Adob_b_Adobe_Abaculus_15_01/D1311_bDP_Adob_b_Adobe_Abaculus_15_01.sft' (rc 19D02E0A-10000002, original rc 19D02E0A-10000002).


[10/31/2012 13:35:47:998 SWAP ERR] {hap=2:app=AboutPI-SDK 1.3.0.26:tid=1568:usr=I337721}
Could not load app


[10/31/2012 19:56:37:862 SWAP INF] {hap=CB3:app=Adobe Reader X 10.0.1.434:tid=4004:usr=V47235}
Elapsed time for upload: 0.609 seconds


[10/31/2012 19:56:38:393 SWAP INF] {hap=CB3:app=Adobe Reader X 10.0.1.434:tid=4004:usr=V47236}
Elapsed time for launch: 1.187 seconds


[10/31/2012 19:56:57:487 SWAP INF] {hap=CB3:app=Adobe Reader X 10.0.1.434:tid=4004:usr=V47234}
App shut down


[10/31/2012 20:01:40:745 ???? INF] {tid=327C:usr=V42235}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[10/31/2012 20:01:40:776 ???? INF] {tid=327C}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[10/31/2012 20:01:40:776 SWAP INF] {hap=CB4:app=Adobe Reader X 10.0.1.434:tid=327C:usr=V422357235}
Elapsed time for upload: 0.609 seconds


[11/01/2012 16:48:44:157 SWAP INF] {hap=11A4:app=Lotus Notes_b1 6.5.40.5086:tid=361C:usr=A422353001}
Elapsed time for launch: 5.219 seconds


[11/01/2012 16:50:21:003 ???? INF] {tid=32D8:usr=W8WS83}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:50:21:066 ???? INF] {tid=32D8}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:50:21:082 SWAP INF] {hap=11A5:app=Adobe Reader X 10.0.1.434:tid=32D8:usr=W8WS83}
Elapsed time for upload: 0.703 seconds


[11/01/2012 16:50:22:503 SWAP INF] {hap=11A5:app=Adobe Reader X 10.0.1.434:tid=32D8:usr=W8WS83}
Elapsed time for launch: 2.218 seconds


[11/01/2012 16:50:50:395 SWAP INF] {hap=11A5:app=Adobe Reader X 10.0.1.434:tid=32D8:usr=A422353001}
App shut down


[11/01/2012 16:53:24:367 ???? INF] {tid=1F80:usr=t405230}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:53:24:383 ???? INF] {tid=1F80}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:53:24:383 SWAP INF] {hap=11A6:app=Show Desktop 1.0:tid=1F80:usr=A422353001}
Elapsed time for upload: 0.531 seconds


[11/01/2012 16:53:24:727 SWAP INF] {hap=11A7:app=Microsoft Office Excel 2003_b1 11.0.8324.1:tid=251C:usr=V422357235}
Elapsed time for upload: 0.0 seconds


[11/01/2012 16:53:24:758 SWAP INF] {hap=11A6:app=Show Desktop 1.0:tid=1F80:usr=V47234}
Elapsed time for launch: 1.78 seconds


[11/01/2012 16:53:25:117 SWAP INF] {hap=11A6:app=Show Desktop 1.0:tid=1F80:usr=V422357235}
App shut down



[11/01/2012 10:45:00:576 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://SRVW23E:554/V1321_BDP_V1_R1_SB/V1321_BDP_C1_P2PM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/01/2012 00:29:59:843 OSDF ERR] {tid=1464}
The Application Virtualization Client could not parse the OSD file 'C:\SoftCache\SoftGrid Client\OSD Cache\edCc4305-3f6C-4dcc-3d70-404eb8bd97d8.osd'. Reason: XML parsing failure (rc 00000A25-00000002)

[11/01/2012 08:24:35:869 ???? ERR] {tid=336C:usr=t405230}
corrupt cp file detected ('V:\V1321_BDP\osguard.cp'). osguard cp file, NO CORRECTIVE ACTION TAKEN


[11/01/2012 22:16:39:240 JGSW ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The Application Virtualization Client could not connect to stream URL 'RTSP://PSWQAPP1:554/V14678993_BDP_C15_E2AM_SS/V14678993_BDP_C15_E2AM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/01/2012 22:16:39:240 SWAP ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The client was unable to connect to an Application Virtualization Server (rc 1690900A-00002002)


[11/01/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The specified application name (Application Integration) is ambiguous. Some potential matches:
Application Integration 7.0.1756.1756
Application Integration 9.2.2373.2373


[11/01/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The Application Virtualization Client cannot open Application Integration

[11/01/2012 00:03:14:313 SWAP WRN] {tid=507C:usr=N28712}
Could not load OSD file \\PSWQAPP1\Content\D1311_bDP_Adobe_Reader_9.3.3\D1311_bDP_Adobe_Reader 9.3.3.osd


[11/01/2012 00:03:14:313 AMGR INF] {tid=507C:usr=i435145}
The app manager could not create an application from '\\PSWQAPP1\Content\D1311_bDP_Adob_dobe_Reader_9.3.3\D1311_bDP_Adob_b_Adobe Reader 9.3.3.osd' (rc 0C405664-00000002).


====

[11/01/2012 13:35:16:987 JGSW ERR] {hap=1:app=Abaculus 1.0.0.1:tid=14C8:usr=R3R7DF42}
The Application Virtualization Client could not connect to stream URL 'RTSP:%SFT_SRV%:554/D1311_bDP_Adob_b_Adobe_Abaculus_15_01/D1311_bDP_Adob_b_Adobe_Abaculus_15_01.sft' (rc 19D02E0A-10000002, original rc 19D02E0A-10000002).


[11/01/2012 13:35:47:998 SWAP ERR] {hap=2:app=AboutPI-SDK 1.3.0.26:tid=1568:usr=I337721}
Could not load app
[11/01/2012 16:53:25:399 SWAP INF] {hap=11A7:app=Microsoft Office Excel 2003_b1 11.0.8324.1:tid=251C:usr=V47234}
Elapsed time for launch: 0.891 seconds

[11/02/2012 10:43:37:527 SWAP INF] {hap=1510:app=Adobe Reader X 10.0.1.434:tid=2AE8:usr=V47234}
App shut down


[11/02/2012 10:44:00:793 SWAP INF] {hap=1511:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=1D80:usr=V422357235}
Elapsed time for upload: 0.0 seconds


[11/02/2012 10:44:03:809 SWAP INF] {hap=1511:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=1D80:usr=V422357235}
Elapsed time for launch: 3.172 seconds


[11/02/2012 10:44:15:965 SWAP INF] {hap=1511:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=1D80:usr=V422357235}
App shut down


[11/02/2012 10:44:20:637 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=V47234}
Elapsed time for upload: 0.0 seconds


[11/02/2012 10:44:23:606 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=V47234}
Elapsed time for launch: 3.125 seconds


[11/02/2012 10:44:32:481 SWAP INF] {hap=150B:app=Microsoft Office Excel 2003_b1 11.0.8324.1:tid=19C:usr=V47234}
App shut down


[11/02/2012 10:44:38:575 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=E831415}
App shut down


[11/02/2012 10:45:00:560 ???? INF] {tid=1650:usr=V47234}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/02/2012 10:45:00:576 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://SRVW23E:554/V1321_BDP_V1_R1_SB/V1321_BDP_C1_P2PM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/02/2012 00:29:59:843 OSDF ERR] {tid=1464}
The Application Virtualization Client could not parse the OSD file 'C:\SoftCache\SoftGrid Client\OSD Cache\edCc4305-3f6C-4dcc-3d70-404eb8bd97d8.osd'. Reason: XML parsing failure (rc 00000A25-00000002)

[11/02/2012 08:24:35:869 ???? ERR] {tid=336C:usr=t405230}
corrupt cp file detected ('V:\V1321_BDP\osguard.cp'). osguard cp file, NO CORRECTIVE ACTION TAKEN


[11/02/2012 22:16:39:240 JGSW ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The Application Virtualization Client could not connect to stream URL 'RTSP://PSWQAPP1:554/V14678993_BDP_C15_E2AM_SS/V14678993_BDP_C15_E2AM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/02/2012 22:16:39:240 SWAP ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The client was unable to connect to an Application Virtualization Server (rc 1690900A-00002002)


[11/02/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The specified application name (Application Integration) is ambiguous. Some potential matches:
Application Integration 7.0.1756.1756
Application Integration 9.2.2373.2373


[11/02/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The Application Virtualization Client cannot open Application Integration

[11/02/2012 00:03:14:313 SWAP WRN] {tid=507C:usr=N28712}
Could not load OSD file \\PSWQAPP1\Content\D1311_bDP_Adobe_Reader_9.3.3\D1311_bDP_Adobe_Reader 9.3.3.osd


[11/02/2012 00:03:14:313 AMGR INF] {tid=507C:usr=i435145}
The app manager could not create an application from '\\PSWQAPP1\Content\D1311_bDP_Adob_dobe_Reader_9.3.3\D1311_bDP_Adob_b_Adobe Reader 9.3.3.osd' (rc 0C405664-00000002).


====
[11/02/2012 13:35:16:987 JGSW ERR] {hap=1:app=Abaculus 1.0.0.1:tid=14C8:usr=R3R7DF42}
The Application Virtualization Client could not connect to stream URL 'RTSP:%SFT_SRV%:554/D1311_bDP_Adob_b_Adobe_Abaculus_15_01/D1311_bDP_Adob_b_Adobe_Abaculus_15_01.sft' (rc 19D02E0A-10000002, original rc 19D02E0A-10000002).


[11/02/2012 13:35:47:998 SWAP ERR] {hap=2:app=AboutPI-SDK 1.3.0.26:tid=1568:usr=I337721}
Could not load app

I am looking to place a logic with in my script to catch the below text from the log file and output to a file with the computer Name and error message. Below are key errors in the “CoreAPP.txt“ file; if any found in current date there is something wrong and I need to fix Manually.

The aim of the script is to report the below errors if found on current date in the “CoreAPP.txt“ file.


1. The Application Virtualization Client could not connect to stream
2. XML parsing failure (rc 00000A25-00000002)
3. corrupt cp file detected
4. The client was unable to connect
5. Virtualization Client cannot open Application Integration
6. Could not load OSD file

Below is my VBscript:

Code:
option Explicit

dim Fso, InFile, out, strComputer, today, strFilePath, InputFile, strLine

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InFile = fso.OpenTextFile("list.txt", ForReading,False,TriStateTrue)

Set out = fso.CreateTextFile("error.log")

 today = Date()

Const ForReading = 1, ForWriting = 2, ForAppending = 3

const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

    Do While Not (InFile.AtEndOfStream)
      strComputer = InFile.ReadLine
     
      Set fso = CreateObject("Scripting.FileSystemObject")
         strFilePath = "\\" & strComputer & "\d$\LOGFILES\"

     Set InputFile = fso.OpenTextFile(strFilePath & "CoreAPP.txt", ForReading,False,TriStateTrue)
      Do While Not (InputFile.AtEndOfStream)
      strLine = InputFile.ReadLine

     if InStr (strLine, today) = 0 Then ' in the log file if text found with today date then it should read from there and look for any of below 6 texts

        If InStr(strLine, "corrupt cp file detected") > 0 Then

		'Kindly help me to integrate below 6 with in this script
		    	  '1. The Application Virtualization Client could not connect to stream
			  '2. XML parsing failure (rc 00000A25-00000002)
  			  '3. corrupt cp file detected
  			  '4. The client was unable to connect
  	 		  '5. Virtualization Client cannot open Application Integration
  			  '6. Could not load OSD file

	      out.WriteLine strLine & vbTab & strComputer
          
        End If
      End If
      
        Loop
      InputFile.close

    Loop

    out.Close
    InFile.Close

The script reads the computers information from list.txt file.

Sample of list.txt

Code:
Server1
server2
server3

CoreAPP.txt file will be there on above (list.txt) server. And the Path is D:\ LOGFILES \CoreAPP.txt

The problem with the current script is script looking for entire file, instead of current date (today is 11/2/2012 but my script showing the output of 11/1/2012 & 10/31/2012 also) information. I mean the script writing output with regardless of Date check this resulting output with past date and current date text in the error.log.
:(

Looking for help!!!!!!!!!!
 
Define your variables (only once, seldem is there a need to redefine) before you use them. Try to use descriptive variable names so the script can be easily evaluated by a human. [tt]inStr[/tt] works here but because an entry in CoreAPP starts with "[##/##/####", I believe using left() is more efficient and has more integrity. Once an entry from today has been found, you need to read the next line in order to read the error.

For the error: What I did is put all the errors in an array (arrErrors). Once I read an error line, I looped through [tt]arrErrors[/tt] to see whether or not the beginning of the line had one of the errors listed in [tt]arrErrors[/tt]. If found, it is written to the [tt]objErrorLog[/tt] file.

NOTE: This code has not been tested

Code:
option Explicit

const ForReading = 1, ForWriting = 2, ForAppending = 3
const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

dim arrErrors(5)
dim objFSO, objServerList, objErrorLog
dim strComputer, strToday, strFilePath, objCoreApp, strLine

set objFSO = CreateObject("Scripting.FileSystemObject")
set objServerList = objFSO.OpenTextFile("list.txt", ForReading, false, TriStateTrue)
set objErrorLog = objFSO.CreateTextFile("error.log")

today = Date()

arrErrors(0) = "The Application Virtualization Client could not connect to stream"
arrErrors(1) = "XML parsing failure"
arrErrors(2) = "corrupt cp file detected"
arrErrors(3) = "The client was unable to connect"
arrErrors(4) = "Virtualization Client cannot open Application Integration"
arrErrors(5) = "Could not load OSD file"
				
do while not (objServerList.AtEndOfStream)
	strComputer = objServerList.ReadLine
	strFilePath = "\\" & strComputer & "\d$\LOGFILES\"
	set objCoreApp = objFSO.OpenTextFile(strFilePath & "CoreAPP.txt", ForReading, False, TriStateTrue)
	do while not (objCoreApp.AtEndOfStream)
		strLine = objCoreApp.ReadLine
		if (left(strLine, len(strToday) + 1) = "[" & strToday) then
			strErrorLine = objCorApp.ReadLine
			for i = 0 to ubound(arrErrors)
				strError = arrErrors(i)
				if (left(lcase(strErrorLine), len(strError)) = lcase(strError)) then
					objErrorLog.WriteLine strErrorLine & vbTab & strComputer
					exit for
				end If
			next
		end If
	loop
	objCoreApp.close
loop

out.Close
objServerList.Close

-Geates
 
it say's "objCoreApp" is required.
I can see it is already DIM
 
I am getting the error as

Variable is undefined: 'objCorApp'
 
Found the error as spell mistake... However still stuck with other errors...

Code:
option Explicit

const ForReading = 1, ForWriting = 2, ForAppending = 3
const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

dim arrErrors(5)
dim objFSO, objServerList, objErrorLog, strErrorLine
dim strComputer, strToday, strFilePath, objCoreApp, strLine, today

set objFSO = CreateObject("Scripting.FileSystemObject")
set objServerList = objFSO.OpenTextFile("list.txt", ForReading, false, TriStateTrue)
set objErrorLog = objFSO.CreateTextFile("error.log")

today = createobject("System.Text.StringBuilder").AppendFormat("[{0:dd/MM/yyyy} ", Date()).ToString()

arrErrors(0) = "The Application Virtualization Client could not connect to stream"
arrErrors(1) = "XML parsing failure"
arrErrors(2) = "corrupt cp file detected"
arrErrors(3) = "The client was unable to connect"
arrErrors(4) = "Virtualization Client cannot open Application Integration"
arrErrors(5) = "Could not load OSD file"
				
do while not (objServerList.AtEndOfStream)
	strComputer = objServerList.ReadLine
	strFilePath = "\\" & strComputer & "\d$\LOGFILES\"
	set objCoreApp = objFSO.OpenTextFile(strFilePath & "CoreAPP.txt", ForReading, False, TriStateTrue)
	do while not (objCoreApp.AtEndOfStream)
		strLine = objCoreApp.ReadLine
		If InStr (strLine, today) = 0 Then
			strErrorLine = objCoreApp.ReadLine
			for i = 0 to ubound(arrErrors)
				strError = arrErrors(i)
				if (left(lcase(strErrorLine), len(strError)) = lcase(strError)) then
					objErrorLog.WriteLine strErrorLine & vbTab & strComputer
					exit for
				end If
			next
		end If
	loop
	objCoreApp.close
loop

out.Close
objServerList.Close

When i compile I am getting error as



Code:
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Microsoft VBScript runtime error (31, 4) : Variable is undefined: 'i'

***** script completed - exit code: 0 *****

Please help me.. from here.....
 
This time got different Error:.. pls help me.. from here...


Code:
option Explicit

const ForReading = 1, ForWriting = 2, ForAppending = 3
const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

dim arrErrors(5)
dim objFSO, objServerList, objErrorLog, strErrorLine, strError
dim strComputer, strToday, strFilePath, objCoreApp, strLine, today, i 

set objFSO = CreateObject("Scripting.FileSystemObject")
set objServerList = objFSO.OpenTextFile("list.txt", ForReading, false, TriStateTrue)
set objErrorLog = objFSO.CreateTextFile("error.log")

today = createobject("System.Text.StringBuilder").AppendFormat("[{0:dd/MM/yyyy} ", Date()).ToString()

arrErrors(0) = "The Application Virtualization Client could not connect to stream"
arrErrors(1) = "XML parsing failure"
arrErrors(2) = "corrupt cp file detected"
arrErrors(3) = "The client was unable to connect"
arrErrors(4) = "Virtualization Client cannot open Application Integration"
arrErrors(5) = "Could not load OSD file"
				
do while not (objServerList.AtEndOfStream)
	strComputer = objServerList.ReadLine
	strFilePath = "\\" & strComputer & "\d$\LOGFILES\"
	set objCoreApp = objFSO.OpenTextFile(strFilePath & "CoreAPP.txt", ForReading, False, TriStateTrue)
	do while not (objCoreApp.AtEndOfStream)
		strLine = objCoreApp.ReadLine
		If InStr (strLine, today) = 0 Then
			strErrorLine = objCoreApp.ReadLine
			for i = 0 to ubound(arrErrors)
				strError = arrErrors(i)
				if (left(lcase(strErrorLine), len(strError)) = lcase(strError)) then
					objErrorLog.WriteLine strErrorLine & vbTab & strComputer
					exit for
				end If
			next
		end If
	loop
	objCoreApp.close
loop

out.Close
objServerList.Close

Below is the script run time error:-

Code:
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Microsoft VBScript runtime error (30, 4) : Input past end of file

***** script completed - exit code: 259 *****
 
OK.. When i change back to the original script.... I am getting the output for all Dates.... I wanted to have output for only current Date... I am sure I am missing the logic on below line... Kindly help me... ...

Below is suspecting logic error Line from full script....

Code:
[b]if (left(strLine, len(strToday) + 1) = "[" & strToday) then[/b]

Below is Full Script..

Code:
option Explicit

const ForReading = 1, ForWriting = 2, ForAppending = 3
const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

dim arrErrors(5)
dim objFSO, objServerList, objErrorLog, strErrorLine, strError
dim strComputer, strToday, strFilePath, objCoreApp, strLine, today, i 

set objFSO = CreateObject("Scripting.FileSystemObject")
set objServerList = objFSO.OpenTextFile("list.txt", ForReading, false, TriStateTrue)
set objErrorLog = objFSO.CreateTextFile("error.log")

'today = createobject("System.Text.StringBuilder").AppendFormat("[{0:dd/MM/yyyy} ", Date()).ToString()

today = Date()

arrErrors(0) = "The Application Virtualization Client could not connect to stream"
arrErrors(1) = "XML parsing failure"
arrErrors(2) = "corrupt cp file detected"
arrErrors(3) = "The client was unable to connect"
arrErrors(4) = "Virtualization Client cannot open Application Integration"
arrErrors(5) = "Could not load OSD file"
				
do while not (objServerList.AtEndOfStream)
	strComputer = objServerList.ReadLine
	strFilePath = "\\" & strComputer & "\d$\LOGFILES\"
	set objCoreApp = objFSO.OpenTextFile(strFilePath & "oldsftlog.txt", ForReading, False, TriStateTrue)
	do while not (objCoreApp.AtEndOfStream)
		strLine = objCoreApp.ReadLine
	'	If InStr (strLine, today) = 0 Then
	if (left(strLine, len(strToday) + 1) = "[" & strToday) then
			strErrorLine = objCoreApp.ReadLine
			for i = 0 to ubound(arrErrors)
				strError = arrErrors(i)
				if (left(lcase(strErrorLine), len(strError)) = lcase(strError)) then
					objErrorLog.WriteLine strErrorLine & vbTab & strComputer
					exit for
				end If
			next
		end If
	loop
	objCoreApp.close
loop

objErrorLog.Close
objServerList.Close

Thanks in advance...
 
I have tried my best to update the script based on the forum feedback. I really stuck here… need you help… please…
Problem:- The script is working as expected, however not catching all the errors from the “CoreAPP.txt” log file.

Below is the log file (CoreAPP.txt) which I am trying to run this updated script.


Below is the Today's log file CoreAPP.txt, where script is able to Capture only one error i.e ("corrupt cp file detected adsa")


Code:
[11/02/2012 10:44:20:637 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=H85415}
Elapsed time for upload: 0.0 seconds


[11/02/2012 10:44:23:606 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=H85415}
Elapsed time for launch: 3.125 seconds


[11/02/2012 10:44:32:481 SWAP INF] {hap=150B:app=Microsoft Office Excel 2003_b1 11.0.8324.1:tid=19C:usr=h101826}
App shut down

corrupt cp file detected qqqqq

[11/02/2012 10:44:38:575 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=H85415}
App shut down


[11/02/2012 10:45:00:560 ???? INF] {tid=1650:usr=h102525}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/5/2012 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://USSEA556:554/P1793_ADP_V5_E2AM_SS/P1793_ADP_V5_E2AM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


The Application Virtualization Client could not connect to stream

[11/5/2012 ???? INF] {tid=1650}
corrupt cp file detected adsa

The Application Virtualization Client could not connect to stream

[11/5/2012 ???? INF] {tid=1650}sad
Client could not connect to stream

[11/5/2012 13:35:16:987  PM SWAP ERR] {hap=2:app=AboutPI-SDK 1.3.0.26:tid=1568:usr=H38742}
hello XML parsing failure

[11/05/2012 Client could not connect to stream
The client was unable to connect to an Application Virtualization Server (rc 1690900A-00002002)


[11/05/2012 [11/05/2012 Client could not connect to stream
Virtualization Client cannot open Application Integration


[11/05/2012 [11/05/2012 Client could not connect to stream
Could not load OSD file

Below is the Updated script :-

Code:
option Explicit

const ForReading = 1, ForWriting = 2, ForAppending = 3
const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

dim arrErrors(5)
dim objFSO, objServerList, objErrorLog, strErrorLine, strError
dim strComputer, strToday, strFilePath, objCoreApp, strLine, today, i 

set objFSO = CreateObject("Scripting.FileSystemObject")
set objServerList = objFSO.OpenTextFile("list.txt", ForReading, false, TriStateTrue)
set objErrorLog = objFSO.CreateTextFile("error.log")

strToday = Date()

arrErrors(0) = "The Application Virtualization Client could not connect to stream"
arrErrors(1) = "XML parsing failure"
arrErrors(2) = "corrupt cp file detected"
arrErrors(3) = "The client was unable to connect"
arrErrors(4) = "Virtualization Client cannot open Application Integration"
arrErrors(5) = "Could not load OSD file"

Do while not (objServerList.AtEndOfStream)

strComputer = objServerList.ReadLine

strFilePath = "\\" & strComputer & "\d$\LOGFILES\"

set objCoreApp = objFSO.OpenTextFile(strFilePath & "CoreAPP.txt", ForReading, False, TriStateTrue)

objErrorLog.WriteLine strComputer & vbTab & "," & vbTab & "Checking"

do while not (objCoreApp.AtEndOfStream)
strLine = objCoreApp.ReadLine

'If InStr (strLine, today) = 0 Then

if (left(strLine, len(strToday) + 1) = "[" & strToday) then

strErrorLine = objCoreApp.ReadLine

for i = 0 to ubound(arrErrors)

strError = arrErrors(i)

if (left(lcase(strErrorLine), len(strError)) = lcase(strError)) then

objErrorLog.WriteLine strErrorLine & vbTab & strComputer

exit for
end If

next

end If
loop
objCoreApp.close
loop
objErrorLog.WriteLine "Completed Checking all the servers"

objErrorLog.Close
objServerList.Close
MsgBox "Script Completed"


The output what i am getting is

Code:
MYserver1	,	Checking
corrupt cp file detected adsa	MYserver1
Completed Checking all the servers


Basically it should also catch all the errors that are in the array and write to my "objErrorLog.WriteLine" But not working... Please help me from this....
 
The problem here is that this new coreapp.txt file appears to be in a different format to the one you originally posted
 
The log file always same as
[Current date and time with some text
some text
some text
Empty Line
Empty Line
Empty Line (some time three lines and some time two empty lines)

My criteria to catch the errors (from the array) on current date text only..

Like above provided log..
 
I have collected the few error lines from different server and consolidated into coreapp.txt and running script for test the script, but not working..

Kindly help me in this..... Thanks.....

Thanks in advance ...
 
I have just tested on my first log against and found still not working.... Kindly help me....

the first posted log file (I have changed the Date to current and tested).

Code:
[10/31/2012 19:53:41:889 SWAP INF] {hap=CB2:app=Internet Explorer_b1 6.0.3790.3959:tid=22C0:usr=B9D327}
Elapsed time for upload: 0.718 seconds


[10/31/2012 19:53:42:639 SWAP INF] {hap=CB2:app=Internet Explorer_b1 6.0.3790.3959:tid=22C0:usr=V9V327}
Elapsed time for launch: 3.250 seconds


[10/31/2012 19:56:37:815 ???? INF] {tid=4004:usr=V47235}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[10/31/2012 19:56:37:846 ???? INF] {tid=4004}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A



[10/31/2012 10:45:00:576 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://SRVW23E:554/V1321_BDP_V1_R1_SB/V1321_BDP_C1_P2PM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[10/31/2012 00:29:59:843 OSDF ERR] {tid=1464}
The Application Virtualization Client could not parse the OSD file 'C:\SoftCache\SoftGrid Client\OSD Cache\edCc4305-3f6C-4dcc-3d70-404eb8bd97d8.osd'. Reason: XML parsing failure (rc 00000A25-00000002)

[10/31/2012 08:24:35:869 ???? ERR] {tid=336C:usr=t405230}
corrupt cp file detected ('V:\V1321_BDP\osguard.cp'). osguard cp file, NO CORRECTIVE ACTION TAKEN


[10/31/2012 22:16:39:240 JGSW ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The Application Virtualization Client could not connect to stream URL 'RTSP://PSWQAPP1:554/V14678993_BDP_C15_E2AM_SS/V14678993_BDP_C15_E2AM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[10/31/2012 22:16:39:240 SWAP ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The client was unable to connect to an Application Virtualization Server (rc 1690900A-00002002)


[10/31/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The specified application name (Application Integration) is ambiguous. Some potential matches:
Application Integration 7.0.1756.1756
Application Integration 9.2.2373.2373


[10/31/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The Application Virtualization Client cannot open Application Integration

[10/31/2012 00:03:14:313 SWAP WRN] {tid=507C:usr=N28712}
Could not load OSD file \\PSWQAPP1\Content\D1311_bDP_Adobe_Reader_9.3.3\D1311_bDP_Adobe_Reader 9.3.3.osd


[10/31/2012 00:03:14:313 AMGR INF] {tid=507C:usr=i435145}
The app manager could not create an application from '\\PSWQAPP1\Content\D1311_bDP_Adob_dobe_Reader_9.3.3\D1311_bDP_Adob_b_Adobe Reader 9.3.3.osd' (rc 0C405664-00000002).


====
[10/31/2012 13:35:16:987 JGSW ERR] {hap=1:app=Abaculus 1.0.0.1:tid=14C8:usr=R3R7DF42}
The Application Virtualization Client could not connect to stream URL 'RTSP:%SFT_SRV%:554/D1311_bDP_Adob_b_Adobe_Abaculus_15_01/D1311_bDP_Adob_b_Adobe_Abaculus_15_01.sft' (rc 19D02E0A-10000002, original rc 19D02E0A-10000002).


[10/31/2012 13:35:47:998 SWAP ERR] {hap=2:app=AboutPI-SDK 1.3.0.26:tid=1568:usr=I337721}
Could not load app


[10/31/2012 19:56:37:862 SWAP INF] {hap=CB3:app=Adobe Reader X 10.0.1.434:tid=4004:usr=V47235}
Elapsed time for upload: 0.609 seconds


[10/31/2012 19:56:38:393 SWAP INF] {hap=CB3:app=Adobe Reader X 10.0.1.434:tid=4004:usr=V47236}
Elapsed time for launch: 1.187 seconds


[10/31/2012 19:56:57:487 SWAP INF] {hap=CB3:app=Adobe Reader X 10.0.1.434:tid=4004:usr=V47234}
App shut down


[10/31/2012 20:01:40:745 ???? INF] {tid=327C:usr=V42235}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[10/31/2012 20:01:40:776 ???? INF] {tid=327C}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[10/31/2012 20:01:40:776 SWAP INF] {hap=CB4:app=Adobe Reader X 10.0.1.434:tid=327C:usr=V422357235}
Elapsed time for upload: 0.609 seconds


[11/01/2012 16:48:44:157 SWAP INF] {hap=11A4:app=Lotus Notes_b1 6.5.40.5086:tid=361C:usr=A422353001}
Elapsed time for launch: 5.219 seconds


[11/01/2012 16:50:21:003 ???? INF] {tid=32D8:usr=W8WS83}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:50:21:066 ???? INF] {tid=32D8}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:50:21:082 SWAP INF] {hap=11A5:app=Adobe Reader X 10.0.1.434:tid=32D8:usr=W8WS83}
Elapsed time for upload: 0.703 seconds


[11/01/2012 16:50:22:503 SWAP INF] {hap=11A5:app=Adobe Reader X 10.0.1.434:tid=32D8:usr=W8WS83}
Elapsed time for launch: 2.218 seconds


[11/01/2012 16:50:50:395 SWAP INF] {hap=11A5:app=Adobe Reader X 10.0.1.434:tid=32D8:usr=A422353001}
App shut down


[11/01/2012 16:53:24:367 ???? INF] {tid=1F80:usr=t405230}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:53:24:383 ???? INF] {tid=1F80}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/01/2012 16:53:24:383 SWAP INF] {hap=11A6:app=Show Desktop 1.0:tid=1F80:usr=A422353001}
Elapsed time for upload: 0.531 seconds


[11/01/2012 16:53:24:727 SWAP INF] {hap=11A7:app=Microsoft Office Excel 2003_b1 11.0.8324.1:tid=251C:usr=V422357235}
Elapsed time for upload: 0.0 seconds


[11/01/2012 16:53:24:758 SWAP INF] {hap=11A6:app=Show Desktop 1.0:tid=1F80:usr=V47234}
Elapsed time for launch: 1.78 seconds


[11/01/2012 16:53:25:117 SWAP INF] {hap=11A6:app=Show Desktop 1.0:tid=1F80:usr=V422357235}
App shut down



[11/01/2012 10:45:00:576 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://SRVW23E:554/V1321_BDP_V1_R1_SB/V1321_BDP_C1_P2PM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/01/2012 00:29:59:843 OSDF ERR] {tid=1464}
The Application Virtualization Client could not parse the OSD file 'C:\SoftCache\SoftGrid Client\OSD Cache\edCc4305-3f6C-4dcc-3d70-404eb8bd97d8.osd'. Reason: XML parsing failure (rc 00000A25-00000002)

[11/01/2012 08:24:35:869 ???? ERR] {tid=336C:usr=t405230}
corrupt cp file detected ('V:\V1321_BDP\osguard.cp'). osguard cp file, NO CORRECTIVE ACTION TAKEN


[11/01/2012 22:16:39:240 JGSW ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The Application Virtualization Client could not connect to stream URL 'RTSP://PSWQAPP1:554/V14678993_BDP_C15_E2AM_SS/V14678993_BDP_C15_E2AM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/01/2012 22:16:39:240 SWAP ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The client was unable to connect to an Application Virtualization Server (rc 1690900A-00002002)


[11/01/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The specified application name (Application Integration) is ambiguous. Some potential matches:
Application Integration 7.0.1756.1756
Application Integration 9.2.2373.2373


[11/01/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The Application Virtualization Client cannot open Application Integration

[11/01/2012 00:03:14:313 SWAP WRN] {tid=507C:usr=N28712}
Could not load OSD file \\PSWQAPP1\Content\D1311_bDP_Adobe_Reader_9.3.3\D1311_bDP_Adobe_Reader 9.3.3.osd


[11/01/2012 00:03:14:313 AMGR INF] {tid=507C:usr=i435145}
The app manager could not create an application from '\\PSWQAPP1\Content\D1311_bDP_Adob_dobe_Reader_9.3.3\D1311_bDP_Adob_b_Adobe Reader 9.3.3.osd' (rc 0C405664-00000002).


====

[11/01/2012 13:35:16:987 JGSW ERR] {hap=1:app=Abaculus 1.0.0.1:tid=14C8:usr=R3R7DF42}
The Application Virtualization Client could not connect to stream URL 'RTSP:%SFT_SRV%:554/D1311_bDP_Adob_b_Adobe_Abaculus_15_01/D1311_bDP_Adob_b_Adobe_Abaculus_15_01.sft' (rc 19D02E0A-10000002, original rc 19D02E0A-10000002).


[11/01/2012 13:35:47:998 SWAP ERR] {hap=2:app=AboutPI-SDK 1.3.0.26:tid=1568:usr=I337721}
Could not load app
[11/01/2012 16:53:25:399 SWAP INF] {hap=11A7:app=Microsoft Office Excel 2003_b1 11.0.8324.1:tid=251C:usr=V47234}
Elapsed time for launch: 0.891 seconds

[11/05/2012 10:43:37:527 SWAP INF] {hap=1510:app=Adobe Reader X 10.0.1.434:tid=2AE8:usr=V47234}
App shut down


[11/05/2012 10:44:00:793 SWAP INF] {hap=1511:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=1D80:usr=V422357235}
Elapsed time for upload: 0.0 seconds


[11/05/2012 10:44:03:809 SWAP INF] {hap=1511:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=1D80:usr=V422357235}
Elapsed time for launch: 3.172 seconds


[11/05/2012 10:44:15:965 SWAP INF] {hap=1511:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=1D80:usr=V422357235}
App shut down


[11/05/2012 10:44:20:637 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=V47234}
Elapsed time for upload: 0.0 seconds


[11/05/2012 10:44:23:606 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=V47234}
Elapsed time for launch: 3.125 seconds


[11/05/2012 10:44:32:481 SWAP INF] {hap=150B:app=Microsoft Office Excel 2003_b1 11.0.8324.1:tid=19C:usr=V47234}
App shut down


[11/05/2012 10:44:38:575 SWAP INF] {hap=1512:app=Microsoft Office Word 2003_b1 11.0.8324.1:tid=3B9C:usr=E831415}
App shut down


[11/05/2012 10:45:00:560 ???? INF] {tid=1650:usr=V47234}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A


[11/05/2012 10:45:00:576 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://SRVW23E:554/V1321_BDP_V1_R1_SB/V1321_BDP_C1_P2PM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/05/2012 00:29:59:843 OSDF ERR] {tid=1464}
The Application Virtualization Client could not parse the OSD file 'C:\SoftCache\SoftGrid Client\OSD Cache\edCc4305-3f6C-4dcc-3d70-404eb8bd97d8.osd'. Reason: XML parsing failure (rc 00000A25-00000002)

[11/05/2012 08:24:35:869 ???? ERR] {tid=336C:usr=t405230}
corrupt cp file detected ('V:\V1321_BDP\osguard.cp'). osguard cp file, NO CORRECTIVE ACTION TAKEN


[11/05/2012 22:16:39:240 JGSW ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The Application Virtualization Client could not connect to stream URL 'RTSP://PSWQAPP1:554/V14678993_BDP_C15_E2AM_SS/V14678993_BDP_C15_E2AM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[11/05/2012 22:16:39:240 SWAP ERR] {hap=1C82:app=bDP c15 E2AM SS 1.0:tid=3D58}
The client was unable to connect to an Application Virtualization Server (rc 1690900A-00002002)


[11/05/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The specified application name (Application Integration) is ambiguous. Some potential matches:
Application Integration 7.0.1756.1756
Application Integration 9.2.2373.2373


[11/05/2012 22:17:09:163 AMGR ERR] {tid=4F54}
The Application Virtualization Client cannot open Application Integration

[11/05/2012 00:03:14:313 SWAP WRN] {tid=507C:usr=N28712}
Could not load OSD file \\PSWQAPP1\Content\D1311_bDP_Adobe_Reader_9.3.3\D1311_bDP_Adobe_Reader 9.3.3.osd


[11/05/2012 00:03:14:313 AMGR INF] {tid=507C:usr=i435145}
The app manager could not create an application from '\\PSWQAPP1\Content\D1311_bDP_Adob_dobe_Reader_9.3.3\D1311_bDP_Adob_b_Adobe Reader 9.3.3.osd' (rc 0C405664-00000002).


====
[11/05/2012 13:35:16:987 JGSW ERR] {hap=1:app=Abaculus 1.0.0.1:tid=14C8:usr=R3R7DF42}
The Application Virtualization Client could not connect to stream URL 'RTSP:%SFT_SRV%:554/D1311_bDP_Adob_b_Adobe_Abaculus_15_01/D1311_bDP_Adob_b_Adobe_Abaculus_15_01.sft' (rc 19D02E0A-10000002, original rc 19D02E0A-10000002).


[11/05/2012 13:35:47:998 SWAP ERR] {hap=2:app=AboutPI-SDK 1.3.0.26:tid=1568:usr=I337721}
Could not load app

The Script output is below:


Code:
MYserver1	,	Checking
corrupt cp file detected adsa	MYserver1	
Completed Checking all the servers
 
I'm not sure how

Code:
[10/31/2012 19:56:37:846 ???? INF] {tid=4004}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A



[10/31/2012 10:45:00:576 ???? INF] {tid=1650}
An error occurred while opening the virtual registry (section: 9), rc: 07B01F0C-0000004A
ElapR
The Application Virtualization Client could not connect to stream URL 'RTSP://SRVW23E:554/V1321_BDP_V1_R1_SB/V1321_BDP_C1_P2PM_SS.sft' (rc 1690900A-00002002, original rc 1690900A-00002002).


[10/31/2012 00:29:59:843 OSDF ERR] {tid=1464}
The Application Virtualization Client could not parse the OSD file 'C:\SoftCache\SoftGrid Client\OSD Cache\edCc4305-3f6C-4dcc-3d70-404eb8bd97d8.osd'. Reason: XML parsing failure (rc 00000A25-00000002)

[10/31/2012 08:24:35:869 ???? ERR] {tid=336C:usr=t405230}
corrupt cp file detected ('V:\V1321_BDP\osguard.cp'). osguard cp file, NO CORRECTIVE ACTION TAKEN

(just a random sampling from the file you provided as an example) meets

[Current date and time with some text
some text
some text
Empty Line
Empty Line
Empty Line (some time three lines and some time two empty lines)

 
not working" is not a very helpful diagnostic report!

"not working" can mean so many DIFFERENT things to different people!

When you change some code and then get different results that are "not working" it would be extremely helpful to YOU and the people who are attempting to help YOU. if you were to include exactly WHAT you changed (changed X from Y to Z) and what different results occurred: error messages, incorrect results, missing data, extraneous data -- INFORMATION about what actuall did occur.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Here, try this, it doesn't care much what the layout is:

Code:
[blue]Const ForReading = 1

' for the sake of this example
strDate = "11/05/2012"
strfile = "d:\log.txt"
strComputer ="Example"

wombat = Array( _
"The Application Virtualization Client could not connect to stream", _
"XML parsing failure (rc 00000A25-00000002)", _
"corrupt cp file detected", _
"The client was unable to connect", _
"Virtualization Client cannot open Application Integration", _
"Could not load OSD file" _
)

wscript.echo strComputer & vbTab & "," & vbTab & "Checking"
With createobject("scripting.FileSystemObject")
	strArray = Split(.OpenTextFile(strfile, ForReading).ReadAll, "[")
	For Each dateline In strArray
		If InStr(dateline, strDate) = 1 Then
			For Each logline In Split(dateline, vbCrLf)
				For Each errorline In wombat
					If InStr(logline, errorline) Then
					  ' Found what we want, so output
					  wscript.echo logline
					End If
				Next
			Next
		End If
	Next
End With
wscript.echo "Completed checking " & strComputer[/blue]
 
there are several fundamental problems.

1) The date the is used in the log file is not in the same format that [tt]date()[/tt] returns ([tt]date()[/tt] does not return leading zeros). I see you acknowledged this before. Here's my solution

Code:
strToday = right("0" & datePart("m", date()), 2) & "/" & right("0" & datePart("d", date()), 2) & "/" & datePart("yyyy", date())

2) The character set used to parse file when opening them is wrong. In my experience, specifying the character set prevents unexpected problems. You have them using a character set equal to TristateTrue (-1) when I always speciffy 0
Code:
set objServerList = objFSO.OpenTextFile("c:\users\djones1\desktop\list.txt", ForReading, false, [red]0[/red])

3) If a file is created everytime the script is run, how is it possible to append to it.  Also, [tt]ForAppending[/tt] should equal 8, not 3.
[code]
set objErrorLog = objFSO.[s]CreateTextFile("error.log")[/s]
set objErrorLog = objFSO.OpenTextFile("error.log", ForAppending, true, 0)

4) Is there a need to specify errors? The header line of each entry specifies whether the entry is Information (INF), a Warning (WRN), or an Error (ERR). Instead of repetatively iterating an array, simply look for the ERR flag.

Code:
if (inStr(strLine, "[" & strToday)) then
	strErrorLine = objCoreApp.ReadLine
	if (inStr(strErrorLine, "ERR]")) then
		if (inStr(lcase(strErrorLine), lcase(strError))) then
			objErrorLog.WriteLine strErrorLine & vbTab & strComputer
			exit for
		end If
	next
end if

-Geates

 
>date() does not return leading zeros

That'll pretty much depend on regional settings. On my Windows 7 box, for example, date() does include leading zeros.
But (and just for fun) here's an alternative using .Net, a version of which Hun9865 nearly used in an earlier iteration of their code.

strToday = createobject("System.Text.StringBuilder").AppendFormat("{0:MM/dd/yyyy} ", date()).ToString()
 
Just tested the script.... Found working when i added below...

strToday = right("0" & datePart("m", date()), 2) & "/" & right("0" & datePart("d", date()), 2) & "/" & datePart("yyyy", date())
 
Thanks to all...
again... Just wanted to drop a line to say "THANKS". This is such a great site. I'm so glad that it is around. Everyone has been extremely helpful. I don't know how often, if at all, that you archive the threads, but I always seem to find what I need in previous threads without starting my own. I have started a couple but that's it. All the people that put there time in to answer questions, I really want to say thanks. Your hard work is truly appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top