Registrations to Open-AudIT forums are now closed. To ask any new questions please visit Opmantek Community Questions.

Open-AudIT

What's on your network?
It is currently Fri Apr 19, 2024 11:22 pm

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
PostPosted: Thu Aug 17, 2006 6:11 am 
Offline
Newbie

Joined: Wed Aug 16, 2006 4:23 am
Posts: 19
I want to search a directory for the latest .log file and read the following bolded lines and get the underlined data and insert it into the db. That I can then display on the website. If I can get the data into the DB I think I can figure out the way to display it. Any one have any advice? Thanks

INFO: WindowsNT Security Compliance check completed on Sat Aug 12 03:02:19 - 2006

INFO: (0 points omitted in EXCEPTIONS)
INFO: Absolute score: 1375/1470 (93.53%)
INFO: Relative score: 1375/1470 (93.53%)


I think a function that you could pass directory/filename/searched text would be awesome. I could see also adding Backup Exec logs to the site.


Update: Got it figured out and it works like a champ. My next thing is reading backupexec logs... Will post next week once its complete.


Last edited by NsOnLn on Sat Aug 19, 2006 1:16 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 18, 2006 5:18 am 
Offline
Newbie

Joined: Wed Aug 16, 2006 4:23 am
Posts: 19
I did some more searching and this is what I have so far. I am sure others may want to do the same. It works, now I just need to get it posted into the form for the DB and create a table...
[code]Dim fso,fold,fil,Absolute,Relative,latestDate,latestName,Line,arrLine

Set fso = CreateObject("Scripting.FileSystemObject")
Set fold = fso.GetFolder("C:\TestFolder")

For each fil in fold.Files
if Mid(lcase(fil.Name),Instrrev(fil.Name,".")) = ".log" Then
if latestDate = "" Then
latestDate = fil.DateLastModified
latestName = fil.Name
Else
if fil.DateLastModified > latestDate Then
latestDate = fil.DateLastModified
latestName = fil.Name
end if
End if
End if
Next
s
if latestName <> "" Then
latestName = fold.path & "\" & latestName
Set fil = fso.OpenTextFile(latestname)
While Not fil.AtEndOfStream
Line = fil.ReadLine
if instr(Lcase(Line),"absolute") Then
arrLine = Split(Line,":")
Absolute = arrLine(2)
end If
if instr(Lcase(Line),"relative") Then
arrLine = Split(Line,":")
Relative = arrLine(2)
end If
Wend
fil.Close
End if

MsgBox "Absolute = " & Absolute
MsgBox "Relative = " & Relative

Set fold = Nothing
Set fso = Nothing[/code]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group