Easily find a string in a Lotus Domino server log

Finding specific error messages or monitoring for a particular event in a Lotus Domino server log can be almost impossible, given the size of most Lotus Domino server log files. But it just got a lot easier, thanks to this script from SearchDomino.com member Felipe Cardoso.

VIEW MEMBER FEEDACK TO THIS TIP

Finding specific error messages or monitoring for a particular event in your Lotus Domino server log is almost impossible, given the size of most Lotus Domino server log files.

This code is similar to a script that would be used to find strings on a Lotus Domino server log. It works with Lotus Domino 6.5 in two different views -- Miscellaneous and Mail events. The result will be a .TXT file with the results of the search. To accomplish this, simply follow these steps.

  1. Create a form with the following fields:

    • Server: Text, which is for the name of the server. You can use a dialog list with a view from Domino Directory here.

    • String: Text, which will be the string to be searched.

    • View: Text, where we'll use a dialog list with the options: MailRoutingEvents and MiscEvents.

    • Day: Date, only with documents more recent than that date.

  2. In the form, create a button with the following code:
Sub Click(Source As Button)
Dim session As NotesSession
Dim ws As NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim pos As Long
Dim count As Long
Dim SEARCHSTRING As String
Dim SEARCHSERVER As String
Dim SEARCHVIEW As String
Dim lin2 As String
Dim SDAY As NotesDateTime
 
Dim Filename As String
Dim FF As Integer
Dim slView As NotesView
Dim slDoc As NotesDocument
Dim ServerLog As NotesDatabase

Set Session = New NotesSession
ServerName = Session.CurrentDatabase.Server
Set ws = New NotesUIWorkspace
Set uidoc = ws.CurrentDocument

Call uidoc.Refresh

SEARCHSTRING = uidoc.FieldGetText("String")
SEARCHSERVER = uidoc.FieldGetText("Server")
SEARCHVIEW = uidoc.FieldGetText("View")
Set SDAY = New NotesDateTime(uidoc.FieldGetText("Day"))

Count = 0
FileName = uidoc.FieldGetText("Server") 
& " - " & uidoc.FieldGetText("String") 
' Include your translation list here, 
' I didn't need nothing more than this
FileName = Replace(FileName, ":", "_", 3)
FileName = Replace(FileName, "\", "_", 3) 
' Take care with the path bellow
FileName = "C:\Temp" & Filename & ".txt"
 
FF = Freefile()
Open FileName For Output As #FF

Set ServerLog = 
New NotesDatabase(SEARCHSERVER, "log.nsf")
Set slView = ServerLog.GetView(SEARCHVIEW)
Set slDoc = slView.GetFirstDocument

While Not slDoc Is Nothing
If SDAY.DateOnly <= slDoc.Created Then
Forall lin In slDoc.EventList
pos = Instr(lin, SEARCHSTRING)
If pos >0 Then
Print #FF, Lin
Count = Count + 1
End If
End Forall
End If
Set slDoc = slView.GetNextDocument(slDoc)
Wend
Close #FF
 
Messagebox "Found " & Count & " ocurrences of [" 
& SEARCHSTRING & "]"
End Sub

MEMBER FEEDBACK TO THIS TIP

There have been a some edits to this tip, per the tip's author. It should run perfectly in the format it is currently in.
—Matt Gervais, Assistant Site Editor, SearchDomino.com

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Felipe Cardoso. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

This was first published in August 2006

Dig deeper on Lotus Notes Domino Monitoring and Logging

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close