## Script (Python) "grepLog" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=searchstring='', filename='event.log' ##title= ## """ return logfile entries """ import logging logger = logging.getLogger('Skins.grepLog') mtool = context.portal_membership member = mtool.getAuthenticatedMember() wtool = context.waeup_tool request = context.REQUEST response = request.RESPONSE def rwrite(s): response.setHeader('Content-type','text/html; charset=ISO-8859-15') response.write(s) loglines = wtool.grepLog(filename,searchstring) if not loglines: return logger.info('%s searched %s' % (member,filename)) #from Products.zdb import set_trace #set_trace() rwrite("--------- grep '%s' %s ----------
\r\n" % (searchstring,filename)) for line in loglines: if not 'ConflictError' in line: rwrite("%s
\r\n" %line) rwrite("--------- end ----------
\r\n")