top of page

PYTHON: RE: MODULE

  • Writer: fredrickwer9
    fredrickwer9
  • Jan 16, 2019
  • 1 min read

{for monitoring}

#################################################### # script: ldap_keys_monitoring.py # : Module : re # : Date : 2019 # : Admin : fwere ###########################################################################

#!/bin/python import os import re

''' USE RE MODULE TO FIND SPECIFIC STRINGS WITHIN FILES OR LOGFILES FOR MONITORING '''

filename = "/app/documentum/dba/log/00018b80/sysadmin/LDAPSynchronizationDoc.txt"

File = open(filename, 'r') flines = File.readlines() line_number = 1 ldaperror=" DM_LDAP_SYNC_E_EXCEPTION_ERROR" for line in flines: if "DM_LDAP_SYNC_E_EXCEPTION_ERROR" in line: # USE RE-MODULE TO SEARCH FOR SPECIFIC LINE OR STRING AND PRINT THEM OUT } for m in re.finditer(r'\bDM_LDAP_SYNC_E_EXCEPTION_ERROR\b', line): if m: print("Sync Error Found") print(line) File.close()

 
 
 

Comments


©2018 by OPEN LINUX LEARNING. Proudly created with Wix.com

bottom of page