示例#1
0
def parse(args):
    """parse entry point, generates a report object
    from a tarball or series of files"""
    logs = diag.find_files(args, args.system_log_prefix)
    print("from directory '%s':" % args.diag_dir)
    node_stats = OrderedDict()
    after_time = dates.date_parse(args.after)
    before_time = dates.date_parse(args.before)
    for log in logs:
        start_log_time, last_log_time = diag.log_range(log)
        with diag.FileWithProgress(log) as log_file:
            raw_events = parser.read_system_log(log_file)
            filter_cache_events_all = [
                event for event in raw_events
                if event.get("event_category", "") == "filter_cache"
            ]
            filter_cache_events = [
                event for event in filter_cache_events_all if "date" in event
                and event["date"] > after_time and event["date"] < before_time
            ]
            item_eviction_stats = _get_stats(filter_cache_events, ItemFCStats,
                                             "eviction_items")
            bytes_eviction_stats = _get_stats(filter_cache_events,
                                              BytesFCStats, "eviction_bytes")
            node = util.extract_node_name(log, True)
            node_stats[node] = OrderedDict([
                ("evictions", (bytes_eviction_stats, item_eviction_stats)),
                ("start", start_log_time),
                ("end", last_log_time),
            ])
    return OrderedDict([
        ("nodes", node_stats),
        ("after_time", after_time),
        ("before_time", before_time),
    ])
示例#2
0
def parse(args):
    """parse entry point, generates a report object
    from a tarball or series of files"""
    logs = diag.find_files(args, args.system_log_prefix)
    if args.diag_dir == ".":
        directory_path = os.getcwd()
        print("from directory '%s':" % directory_path)
    else:
        print("from directory '%s':" % args.diag_dir)
    node_stats = OrderedDict()
    after_time = dates.date_parse(args.after)
    before_time = dates.date_parse(args.before)
    for log in logs:
        start_log_time, last_log_time = diag.log_range(log)
        with diag.FileWithProgress(log) as log_file:
            raw_events = parser.read_system_log(log_file)
            item_ev_stats, bytes_ev_stats = calculate_eviction_stats(
                raw_events, after_time, before_time)
            node = util.extract_node_name(log, True)
            node_stats[node] = OrderedDict([
                ("evictions", (bytes_ev_stats, item_ev_stats)),
                ("start", start_log_time),
                ("end", last_log_time),
            ])
    return OrderedDict([
        ("nodes", node_stats),
        ("after_time", after_time),
        ("before_time", before_time),
    ])
示例#3
0
def parse(args):
    """parse entry point, generates a report object
    from a tarball or series of files"""
    logs = diag.find_files(args, args.system_log_prefix)
    print("from directory '%s':" % args.diag_dir)
    node_stats = {}
    after_time = dates.date_parse(args.after)
    before_time = dates.date_parse(args.before)
    for log in logs:
        start_log_time, last_log_time = diag.log_range(log)
        with diag.FileWithProgress(log) as log_file:
            raw_events = parser.read_system_log(log_file)
            events = [
                event for event in raw_events
                if event['date'] > after_time and event['date'] < before_time
            ]
            filter_cache_events = [event for event in events \
                    if event['event_category'] == 'filter_cache']
            item_eviction_stats = _get_stats(filter_cache_events, ItemFCStats,
                                             'eviction_items')
            bytes_eviction_stats = _get_stats(filter_cache_events,
                                              BytesFCStats, 'eviction_bytes')
            node = util.extract_node_name(log, True)
            node_stats[node] = {"evictions" : (bytes_eviction_stats, item_eviction_stats), \
                "start": start_log_time, "end": last_log_time, \
                }
    return { \
            "nodes": node_stats, \
            "after_time": after_time, \
            "before_time": before_time, \
            }