I need to write a C# program that will search a certain log file on about 100 machines for certain text and output that to a table or listbox or some other output.
Posted on 2004-10-11
I need to write a loop that will check a certain log file on about 100 machines and then in a list box print out the machine name, the last instance of the word "backup" in the log and the date following "date=" in the log.
Here is an example of the log:
<![LOG[Retrieved local Management Point from AD: BACKUP]LOG]!><time="13:16:03.645+300" date="10-11-2004" component="LocationServices" context="" type="1" thread="320" file="lsad.cpp:2514">
So what I need is:
Check the log file at \\machine1\C$\Windows\System32\Log\backup.log all the way through
Find last instance of the word "BACKUP" and "date=" in the log and put that into a list box or some other form of output. If "BACKUP" doesn't exist just print "No" in the listbox next to that machine name.
Hope this makes sense.
After that, I'd like to make changes to the program to allow it to interact with Active Directory and check the c:\windows\system32\Logs\backup.log on every machine in the OU that I choose. Is that possible?
Thanks in advance,