Hello Scripting Experts,
I have a log file on remote servers.. in remote servers c:\vb\text.log
I have included my remote systems in list.Txt
like
below is the sample of log..
Below is my Script
Basically the above script should search from current date line only from the text.log file "that is [10/24/2012 nos appdown". then if found as "Nos" in the current datet line.. then it should write to the error.log with computer Name.
In my case the output is not comming , however looks like it is searching for the string "Nos".
Kindly gail break me from this situation....
I have a log file on remote servers.. in remote servers c:\vb\text.log
I have included my remote systems in list.Txt
like
Code:
server1
server2
Code:
application working
[10/23/2012 working
[10/24/2012 nos appdown
error found you need to check this
.
Below is my Script
Code:
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InFile = fso.OpenTextFile("list.Txt")
Set out = fso.CreateTextFile("error.log")
Const ForReading = 1
Do While Not (InFile.atEndOfStream)
strComputer = InFile.ReadLine
today = Date()
Set fso = CreateObject("Scripting.FileSystemObject")
strFilePath = "\\" & strComputer & "\c$\vb\"
Set InputFile = fso.OpenTextFile(strFilePath & "text.log", 1)
Do While Not (InputFile.AtEndOfStream)
strLine = InputFile.ReadLine
If Left(line, Len(today)+1) = "[" & today Then
' line timestamped with today's date
If InStr(line, "nos") > 0 Then
' line contains "error"
out.WriteLine InStr & vbTab & strComputer
End If
End If
Loop
InputFile.close
Loop
out.Close
InFile.Close
Basically the above script should search from current date line only from the text.log file "that is [10/24/2012 nos appdown". then if found as "Nos" in the current datet line.. then it should write to the error.log with computer Name.
In my case the output is not comming , however looks like it is searching for the string "Nos".
Kindly gail break me from this situation....