def main(): (options, args) = parser.parse_args() if len(args) != 2: parser.print_help() sys.exit(1) logfile = _open_logfile(args[0]) warnfile = os.fdopen(int(args[1]), 'w', 0) # For now we aggregate all the alert_hooks. alert_hooks = [] for patterns_path in options.pattern_paths.split(','): alert_hooks.extend( monitors_util.build_alert_hooks_from_path(patterns_path, warnfile)) _set_logfile_close_signal_handler(logfile) try: monitors_util.process_input(sys.stdin, logfile, options.log_timestamp_format, alert_hooks) finally: logfile.close() _unset_signal_handler()
def main(): (options, args) = parser.parse_args() if len(args) != 2: parser.print_help() sys.exit(1) logfile = _open_logfile(args[0]) warnfile = os.fdopen(int(args[1]), 'w', 0) # For now we aggregate all the alert_hooks. alert_hooks = [] for patterns_path in options.pattern_paths.split(','): alert_hooks.extend(monitors_util.build_alert_hooks_from_path( patterns_path, warnfile)) _set_logfile_close_signal_handler(logfile) try: monitors_util.process_input( sys.stdin, logfile, options.log_timestamp_format, alert_hooks) finally: logfile.close() _unset_signal_handler()
def _process_line(self, line): input_file = cStringIO.StringIO(line + '\n') monitors_util.process_input(input_file, self._logfile, alert_hooks=self._alert_hooks)