Пример #1
0
 def start(self):
     """ The Gamin watch monitor in :attr:`mon` must be created by
     the daemonized process, so is created in ``start()``. Before
     the :class:`Gamin.WatchMonitor` object is created, monitors
     are added to :attr:`add_q`, and are created once the watch
     monitor is created."""
     FileMonitor.start(self)
     self.mon = WatchMonitor()
     for monitor in self.add_q:
         self.AddMonitor(*monitor)
     self.add_q = []
Пример #2
0
 def __init__(self, ignore=None, debug=False):
     FileMonitor.__init__(self, ignore=ignore, debug=debug)
     self.mon = WatchMonitor()
     self.counter = 0
Пример #3
0
 def __init__(self, debug=False):
     FileMonitor.__init__(self, debug)
     self.mon = WatchMonitor()
     self.counter = 0
     self.events = []
Пример #4
0
def monitor(path, event):
	if event == GAMExists:
		g.readlines()
	if event == GAMChanged:
		ultimasL=g.readlines()
		for l in ultimasL:
			dfields = logfields(l)
			if logfilter(dfields, dfilters):
				if opts.filtrables:
					sys.stderr.write(l[:24]+" "+l.split()[6]+" "+l.split()[8]+" "+l.split()[13]+"\n")
				elif opts.completo: 
					sys.stderr.write(l)
						
	return True

mon = WatchMonitor()
mon.watch_file(opts.logfile, monitor)
time.sleep(1)
fd = mon.get_fd()

while True:
	select([fd],[],[])
	if mon.event_pending():
		mon.handle_events() 

mon.stop_watch(fichero)
del mon

#para probarlo abro otra terminal y hago echo "xxxx" >> vsftpd.log
#Si quiero meter varias lineas en bloque hago echo "xxxx" >> vsftpd.log && echo "yyyyy" >> vsftpd.log
Пример #5
0
 def start(self):
     FileMonitor.start(self)
     self.mon = WatchMonitor()
     for monitor in self.add_q:
         self.AddMonitor(*monitor)
     self.add_q = []