Home > Domino Tips > Administrator > Server > Find Errors in Notes Log
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SERVER

Find Errors in Notes Log


Mike Long
04.05.2005
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

This tip is useful to automatically scan the Notes Logs on servers for keywords that indicate errors. Results are e-mailed to the user indicated in the script.

'Find errors: 

'This agent searches today's documents in server logs (log.nsf) for particular words that indicate errors.
'A list is generated and inserted into a mail message that is sent to the current user.
'Add the agent to a database on the server and schedule it to run daily. 
'Make sure that the agent signer has rights to read the Notes Log.


Option Public

Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim mailDb As NotesDatabase
Dim mailDoc As NotesDocument
Dim dt As String
Dim item As NotesItem
Dim rtitem As NotesRichTextItem
Dim rtStyle As NotesRichTextStyle
Const ADMIN = "Your Administrator"

Sub Initialize
 Dim s As New NotesSession
 
 REM Words to search log for. Increase array 
bounds and add more words if needed.
 Dim srch (4) As String
 srch(0) = "unable"
 srch(1) = "error"
 srch(2) = "fail"
 srch(3) = "ATTEMPT"
 srch(4) = "invalid"
 
 REM Servers' logs to search. Increase array
 bounds and add more servers if needed.
 Dim srv (3) As String
 srv(0) = "Svr1"
 srv(1) = "Svr2"
 srv(2) = "Svr3"
 srv(3) = "etc"
 
 REM Set up  today's date and format 
 dt = Format(Date$, "mm/dd/yyyy")
 
 REM Create mail memo to hold output from server log    
 Dim db As NotesDatabase
 Set db = s.GetDatabase("", "names.nsf", False)
 Set mailDoc = New NotesDocument( db )
 Set rtitem = New NotesRichTextItem( mailDoc, "Body")
 Set rtStyle = s.CreateRichTextStyle
 Dim msg As String
 msg = "Search Keywords: "
 Forall w In srch
  msg = msg & { "} & w & {"}
 End Forall
 rtStyle.Bold=True
 Call rtitem.AppendStyle(rtStyle)
 Call rtItem.AppendText( msg )
 rtStyle.Bold = False
 Call rtitem.AppendStyle(rtStyle)
 Call rtitem.AddNewline(2)
 
 REM Process for every server
 Forall m In srv
  Print "Searching Notes Log on " & m
  Set db = s.GetDatabase( m, "log.nsf")
  Call rtitem.AddNewline(1)  
  rtStyle.Bold = True 
  Call rtitem.AppendStyle(rtStyle)
  Call  rtitem.AppendText("Log for " & db.Server)
  rtStyle.Bold = False
  Call rtitem.AppendStyle(rtStyle)
  Call rtitem.AddNewline(2)
  
  REM Process for each search word in one server's log
  Forall e In srch
   Set dc = db.FTSearch( dt , 0)
   Call dc.FTSearch(e, 0)
   
   REM Process if any words are found
   If dc.Count > 0  Then
    REM Process the list of docs containing the 
search word and add them to mail message    
    Call FindErrors( dc , e)
   End If
  End Forall  'process next search word
 End Forall  'process next server 
 
 REM Send report to admin
 If Not mailDoc Is Nothing Then
  mailDoc.Form = "Memo"
  mailDoc.From = "Notes Error Log Report"
  mailDoc.Subject = "Error Report from Notes Logs"
  Call mailDoc.Send(False, ADMIN)
 End If
 
End Sub
Sub FindErrors
( coll As NotesDocumentCollection, srctxt As String)
 For i = 1 To coll.Count
  Set doc = coll.GetNthDocument(i)
  Set item = doc.GetFirstItem("EventList")
  Forall v In item.Values
   'Msgbox v
   chk = Instr(1, v, srctxt, 5)
   If Not chk = 0 Then
    'Msgbox v
    Call rtitem.AppendText( v )
    Call rtitem.AddNewline(1)
   End If
  End Forall
 Next
End Sub

MEMBER FEEDBACK TO THIS TIP

Whenever I run this tip I get the following error message:
Object Variable not set:

I assume the only things I have to set are:
Administrator email address
SVR = server
srch = keyword

—A. Wilkie

******************************************

The agent as posted is designed to be installed in a server database and scheduled to run on a server. The user is apparently running it on a Notes client which will generate this error. I run it on a schedule from the server so I can have my report first thing in the morning.

However, I also have a modified version that can be added to the user's mail database and launched from the Notes client when he is in the mail file. To view this version of the tip, click here.

—Mike Long, tip author

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

Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Server
How to move Notes databases off Domino 8 servers and save disk space
Move a Lotus Domino server to a new certifier without a reinstall
Securely connect Lotus Domino servers on different domains
Track and record Lotus Notes user logins to Domino Server
Use SMTP outbound authentication to relay hosts in Lotus Notes Domino 8
Log off idle Lotus Notes users for better Domino Server performance
Copy Lotus Notes databases from the Domino Server console command line
How to perform an in-place upgrade of Lotus Domino server hardware
Daylight Saving Time 2007 -- seven helpful tips for Lotus Notes administrators
FileZilla

Lotus Notes Domino Agents
Quickly scan all databases on a Lotus Domino server
How the Agent Profiler tool improves Notes/Domino performance
Run or restart Notes/Domino agents via text messages
Calculating results for a column in a Lotus Notes view
Approve Lotus Notes documents using a BlackBerry mobile device
LotusScript agent indexes Lotus Notes/Domino databases
Top 10 Lotus Notes/Domino coding and development tips of 2008
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts