Manage Learn to apply best practices and optimize your operations.

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 member Felipe Cardoso.


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 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)
Close #FF
Messagebox "Found " & Count & " ocurrences of [" 
End Sub


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,

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

This tip was submitted to the 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.

Dig Deeper on Lotus Notes Domino Monitoring and Logging

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.



  • iSeries tutorials'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 ...