def on_activate(self): # Listen sockets server = SyslogServer(service=self) for l in config.syslogcollector.listen.split(","): if ":" in l: addr, port = l.split(":") else: addr, port = "", l self.logger.info("Starting syslog server at %s:%s", addr, port) try: server.listen(port, addr) except socket.error as e: metrics["error", ("type", "socket_listen_error")] += 1 self.logger.error("Failed to start syslog server at %s:%s: %s", addr, port, e) server.start() # Send spooled messages every 250ms self.logger.debug("Stating message sender task") self.send_callback = tornado.ioloop.PeriodicCallback( self.send_messages, 250, self.ioloop) self.send_callback.start() # Report invalid sources every 60 seconds self.logger.info("Stating invalid sources reporting task") self.report_invalid_callback = tornado.ioloop.PeriodicCallback( self.report_invalid_sources, 60000, self.ioloop) self.report_invalid_callback.start() # Start tracking changes self.ioloop.add_callback(self.get_object_mappings)
def on_activate(self): # Listen sockets server = SyslogServer(service=self) for addr, port in server.iter_listen(config.syslogcollector.listen): self.logger.info("Starting syslog server at %s:%s", addr, port) try: server.listen(port, addr) except socket.error as e: metrics["error", ("type", "socket_listen_error")] += 1 self.logger.error("Failed to start syslog server at %s:%s: %s", addr, port, e) server.start() # Report invalid sources every 60 seconds self.logger.info("Stating invalid sources reporting task") self.report_invalid_callback = tornado.ioloop.PeriodicCallback( self.report_invalid_sources, 60000, self.ioloop ) self.report_invalid_callback.start() # Start tracking changes self.ioloop.add_callback(self.get_object_mappings)