コード例 #1
0
                                 "".format(et, ",".join(valid_ets)))

    # Check specified pattern
    if opt.use_regexp and not opt.pattern:
        parser.error("The --pattern option is required if REGEXP option is "
                     "set.")

    pattern = opt.pattern
    if opt.pattern and not opt.use_regexp:
        # Convert SQL LIKE pattern to Python REGEXP
        pattern = pattern_matching.convertSQL_LIKE2REGEXP(opt.pattern)

    # Check if the values specified for the --status option are valid
    status_list = []
    if opt.status:
        status_list = get_value_intervals_list(parser, opt.status, '--status',
                                               'status')

    # Create dictionary of options
    options = {
        'log_name': args[0],
        'verbosity': opt.verbosity,
        'format': opt.format,
        'users': users,
        'start_date': start_date,
        'end_date': end_date,
        'pattern': pattern,
        'use_regexp': opt.use_regexp,
        'query_type': query_types,
        'event_type': event_types,
        'status': status_list,
    }
コード例 #2
0
    # Check specified path for the relay log index file.
    relay_log_index_file = None
    if opt.relay_log_index:
        relay_log_index_file = get_absolute_path(opt.relay_log_index)
        if not os.path.isfile(relay_log_index_file):
            parser.error("The specified value for --relay-index is not a "
                         "file: {0}".format(opt.relay_log_index))
        if not os.access(relay_log_index_file, os.R_OK | os.W_OK):
            parser.error("You do not have enough privileges to access the "
                         "specified relay log index file: "
                         "{0}.".format(opt.relay_log_index))

    # Check values specified for the --sequence option.
    sequence_list = []
    if opt.sequence:
        sequence_list = get_value_intervals_list(parser, opt.sequence,
                                                 '--sequence', 'sequence')

    # Check values specified for the --modified-before option.
    modified_before = None
    if opt.modified_before:
        modified_before = check_date_time(parser,
                                          opt.modified_before,
                                          'modified',
                                          allow_days=True)

    # Check options not required for specific log types.
    if opt.log_type == LOG_TYPE_BIN:
        if opt.relay_log_basename:
            print(
                WARN_OPT_NOT_REQUIRED_FOR_TYPE.format(
                    opt='--relay-log-basename',
コード例 #3
0
                                 "".format(et, ",".join(valid_ets)))

    # Check specified pattern
    if opt.use_regexp and not opt.pattern:
        parser.error("The --pattern option is required if REGEXP option is "
                     "set.")

    pattern = opt.pattern
    if opt.pattern and not opt.use_regexp:
        # Convert SQL LIKE pattern to Python REGEXP
        pattern = pattern_matching.convertSQL_LIKE2REGEXP(opt.pattern)

    # Check if the values specified for the --status option are valid
    status_list = []
    if opt.status:
        status_list = get_value_intervals_list(parser, opt.status, '--status',
                                               'status')

    # Create dictionary of options
    options = {
        'log_name': args[0],
        'verbosity': opt.verbosity,
        'format': opt.format,
        'users': users,
        'start_date': start_date,
        'end_date': end_date,
        'pattern': pattern,
        'use_regexp': opt.use_regexp,
        'query_type': query_types,
        'event_type': event_types,
        'status': status_list,
    }
コード例 #4
0
    # Check specified path for the relay log index file.
    relay_log_index_file = None
    if opt.relay_log_index:
        relay_log_index_file = get_absolute_path(opt.relay_log_index)
        if not os.path.isfile(relay_log_index_file):
            parser.error("The specified value for --relay-index is not a "
                         "file: {0}".format(opt.relay_log_index))
        if not os.access(relay_log_index_file, os.R_OK | os.W_OK):
            parser.error("You do not have enough privileges to access the "
                         "specified relay log index file: "
                         "{0}.".format(opt.relay_log_index))

    # Check values specified for the --sequence option.
    sequence_list = []
    if opt.sequence:
        sequence_list = get_value_intervals_list(parser, opt.sequence,
                                                 '--sequence', 'sequence')

    # Check values specified for the --modified-before option.
    modified_before = None
    if opt.modified_before:
        modified_before = check_date_time(parser, opt.modified_before,
                                          'modified', allow_days=True)

    # Check options not required for specific log types.
    if opt.log_type == LOG_TYPE_BIN:
        if opt.relay_log_basename:
            print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format(
                opt='--relay-log-basename',
                type='{0}log'.format(LOG_TYPE_BIN)))
        if opt.relay_log_index:
            print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format(