0

我有一个应用程序会自动在日志文件下面写入名称为“CoreAPP.txt”</p>

“CoreAPP.txt”示例:

[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

我希望在我的脚本中放置一个逻辑,以从日志文件中捕获以下文本并输出到带有计算机名称和错误消息的文件。以下是“CoreAPP.txt”文件中的关键错误;如果在当前日期发现任何问题,我需要手动修复。

该脚本的主要目的是如果在“CoreAPP.txt”文件中的当前日期日志文本中发现以下错误,则报告以下错误。

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

下面是我的脚本:

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 

上面的脚本将从 list.txt 文件中读取计算机信息。

list.txt 示例

Server1
server2
server3

CoreAPP.txt 文件将在上面的(list.txt)服务器上。路径是 D:\ LOGFILES \CoreAPP.txt

当前脚本的问题是,脚本查找整个文件,而不是当前日期(今天是 2012 年 11 月 2 日,但我的脚本检查并给出了 11/1/2012 和 10/31/2012 的输出)。我的意思是脚本编写输出时不考虑日期检查,生成的输出带有错误日志中的过去日期和当前日期文本。

寻求帮助!!!

4

1 回答 1

0

您的instr函数始终返回 0(因此条件变为真),因为您测试date()的格式10-31-2012为 [10/31/2012 08:24:35:869 ???? 呃]。

增强功能:

  1. 您需要正确的日期格式
  2. 您需要测试 <> 0

我建议从 dotnet stringbuilder 中捕获和格式化日期,例如

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

这将自动在字符串前面加上[一个空格。现在您可以通过正确使用 instr 来测试字符串是否包含今天的日期。由于字符串是从第一个字符中找到的,我会像这样测试它:

If InStr (strLine, today) = 1 Then
于 2012-11-02T12:19:58.903 回答