def configure(self, ns): # load configuration section = ns.section("search") self.host = urlparse.urlparse(section.getString("host", 'http://localhost:8080')) self.username = section.getString("username", None) self.password = section.getString("password", None) if section.getBoolean("prompt password", False): self.password = getpass("Password: "******"store", "main") # get the list of fields to retrieve self.fields = section.getList("retrieve fields", str, None) if self.fields != None: pass # get the list of fields to sort by self.sortby = section.getList("sort fields", str, None) if self.sortby != None: pass self.reverse = section.getBoolean("sort reverse", False) self.limit = section.getInt("limit", 100) self.longfmt = section.getBoolean("long format", False) self.tz = section.getString("timezone", None) if self.tz != None: self.tz = dateutil.tz.gettz(self.tz) # concatenate the command args into the query string self.query = ' '.join(ns.args) # configure server logging logconfigfile = section.getString('log config file', "%s.logconfig" % ns.appname) if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None)
def configure(self, settings): # load configuration section = settings.section("search") self.host = section.getString("host", 'localhost:45565') self.username = section.getString("username", None) self.password = section.getString("password", None) if section.getBoolean("prompt password", False): self.password = getpass("Password: "******"limit", 100) self.reverse = section.getBoolean("display reverse", False) self.longfmt = section.getBoolean("long format", False) self.indices = section.getList(str, "use indices", None) self.tz = section.getString("timezone", None) if self.tz != None: self.tz = dateutil.tz.gettz(self.tz) # get the list of fields to display self.fields = section.getList(str, "display fields", None) # concatenate the command args into the query string self.query = ' '.join(settings.args()) # configure server logging logconfigfile = section.getString('log config file', "%s.logconfig" % settings.appname) if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None)
def configure(self, settings): # load configuration section = settings.section("tail") self.host = section.getString("host", 'localhost:45565') self.username = section.getString("username", None) self.password = section.getString("password", None) if section.getBoolean("prompt password", False): self.password = getpass("Password: "******"limit", 100) self.longfmt = section.getBoolean("long format", False) self.indices = section.getList(str, "use indices", None) self.refresh = section.getInt("refresh", 3) self.tz = section.getString("convert timezone", None) if self.tz != None: self.tz = dateutil.tz.gettz(self.tz) # get the list of fields to display self.fields = section.getList(str, "display fields", None) if not self.fields == None: if not 'default' in self.fields: self.fields.append('default') if not 'ts' in self.fields: self.fields.append('ts') # concatenate the command args into the query string self.query = ' '.join(settings.args()) # configure server logging logconfigfile = section.getString('log config file', "%s.logconfig" % settings.appname) if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None)
def configure(self, ns): # load configuration section = ns.section("run") # configure pipeline plugins = PluginManager() args = ns.args if len(args) > 0: spec = " ".join(args) else: spec = section.getString("pipeline", None) if spec == None: raise ConfigureError("no pipeline was specified") nodes = makepipeline(parsenodespec(spec)) if len(nodes) < 2: raise ConfigureError("pipeline must consist of at least one source and one sink") source = nodes.pop(0) sink = nodes.pop(-1) filters = nodes self.pipeline = Pipeline(source, sink, filters) # configure server logging logconfigfile = section.getString('log config file', "%s.logconfig" % ns.appname) if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None)
def configure(self, settings): self.settings = settings section = settings.section('server') self.user = section.getString('runtime user', None) self.group = section.getString('runtime group', None) self.pidfile = section.getPath('pid file', '/var/lib/terane/terane-server.pid') self.debug = section.getBoolean('debug', False) logconfigfile = section.getString('log config file', "%s.logconfig" % settings.appname) if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: logfile = section.getPath('log file', '/var/log/terane/terane-server.log') verbosity = section.getString('log verbosity', 'WARNING') if verbosity == 'DEBUG': level = DEBUG elif verbosity == 'INFO': level = INFO elif verbosity == 'WARNING': level = WARNING elif verbosity == 'ERROR': level = ERROR else: raise ConfigureError("Unknown log verbosity '%s'" % verbosity) startLogging(FileHandler(logfile), level, logconfigfile) self.threadpoolsize = section.getInt('thread pool size', 20) reactor.suggestThreadPoolSize(self.threadpoolsize)
def configure(self, ns): section = ns.section("admin") self.host = urlparse.urlparse(section.getString("host", 'http://localhost:8080')) self.username = section.getString("username", None) self.password = section.getString("password", None) if section.getBoolean("prompt password", False): self.password = getpass.getpass("Password: "******"%s.logconfig" % ns.appname) if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None)
def configure(self, ns): # load configuration section = ns.section("syslog") self.nprocs = section.getInt("num processes", None) self.port = section.getInt("listen port", 10514) # configure server logging logconfigfile = section.getString('log config file', "%s.logconfig" % ns.appname) getLogger('tornado') if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None) self.handler = TCPHandler(max_buffer_size=65535)
def configure(self, settings): # load configuration section = settings.section("grok") self.host = section.getString("host", 'localhost:45565') self.username = section.getString("username", None) self.password = section.getString("password", None) if section.getBoolean("prompt password", False): self.password = getpass("Password: "******"%s.logconfig" % settings.appname) # configure server logging if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None)
def configure(self, ns): # load configuration section = ns.section("etl") # publish to the specified sink self.store = section.getString("sink", "main") # configure pipeline source = StdinSource() source.configure(section) sink = SyslogSink() sink.configure(section) plugins = PluginManager() nodes = parsenodespec(section.getString("filters", None)) self.pipeline = Pipeline(source, sink, makepipeline(nodes)) # configure server logging logconfigfile = section.getString('log config file', "%s.logconfig" % ns.appname) if section.getBoolean("debug", False): startLogging(StdoutHandler(), DEBUG, logconfigfile) else: startLogging(None)
def run(self): """ Start the event loop. """ if self.executecmd != None: cmdline = self.executecmd.split(None, 1) self.command(cmdline[0], cmdline[1]) self._ui.set_body(self) ev = urwid.TwistedEventLoop(reactor=reactor) self._loop = urwid.MainLoop(self._ui, palette=self._palette, unhandled_input=self._unhandled_input, event_loop=ev) reactor.callLater(0, self.startService) self._loop.run() logger.debug("exited urwid main loop") if self.debug == True: startLogging(StdoutHandler(), DEBUG, self.logconfigfile) return 0