我在e:\ logs \ action.log中保存的远程计算机上的文本(50个服务器的列表)下方 这个action.log将包含一个Date&时间和每次执行的动作都将被跟踪并附加日期&时间.....并且下一行将有动作 关联就像工作,不工作......
示例action.log文件文本.....
[10/15/2012 09:33:56:248 qwe rtd] {some text will be there here}
this time it is working on the task and taken: 2.31 seconds
[10/15/2012 09:34:55:248 qwe rtd] {some text will be there here}
this time it is working on the task and taken: 3.31 seconds
[10/16/2012 09:33:56:248 qwe rtd] {some text will be there here}
this time it is working on the task and taken: 2.31 seconds
[10/16/2012 09:34:55:248 qwe rtd] {some text will be there here}
this time it is working on the task and taken: 3.31 seconds
[10/16/2012 09:34:55:248 qwe rtd] {you got error}
You got error as file missing..
脚本我正在寻找一个脚本来读取当前日期的action.log(上面示例日期的今天日期是10/16/2012)。如果发现任何名为“你得到错误”或“错误文件丢失...”的文本,则输出后跟服务器名称为excel或文本文件。
(基本标准是仅搜索当前日期文本....因为过去的错误无效......) 从论坛寻找一些脚本......我是脚本新手......
答案 0 :(得分:0)
尝试这样的事情:
computer = CreateObject("WScript.Network").ComputerName
today = Right("0" & Month(Date), 2) & "/" & Right("0", Day(Date), 2) & "/" _
& Year(Date)
Set fso = CreateObject("Scripting.FileSystemObject")
Set in = fso.OpenTextFile("action.log", 1)
Set out = fso.OpenTextFile("error.log", 2)
Do Until in.AtEndOfStream
line = in.ReadLine
If Left(line, Len(today)+1) = "[" & today Then
' line timestamped with today's date
If InStr(line, "error") > 0 Then
' line contains "error"
out.WriteLine line & vbTab & in.ReadLine & vbTab & computer
End If
End If
Loop
in.Close
out.Close