Easily find a string in a Lotus Domino server log


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, 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

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.