def parse_diag(args, transform=_group_uniq): """ parses the following files to generate a report object: - all system.log (GC pause times) - all output.log (configuration at runtime from last reboot) - all cfsats files (table stats) -- node_info.json (drive configuration) -- all blockdev_report (read ahead) """ # find output logs node_configs = node_env.initialize_node_configs(args.diag_dir) output_logs = diag.find_logs(args.diag_dir, args.output_log_prefix) # find system.logs system_logs = diag.find_logs(args.diag_dir, args.system_log_prefix) warnings = node_env.find_config_in_logs(node_configs, output_logs, system_logs) warn_missing(node_configs, output_logs, warnings, "missing output logs") warn_missing(node_configs, system_logs, warnings, "missing system logs") # find block dev node_info_list = diag.find_logs(args.diag_dir, args.node_info_prefix) if node_info_list: # only set block_dev_results if we find a single node_info.json with diag.FileWithProgress(node_info_list[0]) as node_info_json: # read all the block dev reports if node_info_json.error: warnings.append( "unable to read node_info.json with error: '%s'" % node_info_json.error) block_dev_reports = diag.find_logs(args.diag_dir, args.block_dev_prefix) warn_missing(node_configs, block_dev_reports, warnings, "missing blockdev_reports") cass_drive_ra = read_ahead.get_cass_drive_read_ahead( node_info_json, block_dev_reports) read_ahead.add_block_dev_to_config(cass_drive_ra, node_configs) else: warnings.append("unable to read '%s'" % args.node_info_prefix) transformed_configs = transform(node_configs) for warn in node_env.add_gc_to_configs(transformed_configs, system_logs): warnings.append(warn) # add cfstats if present cfstats_files = diag.find_logs(args.diag_dir, args.cfstats_prefix) warn_missing(node_configs, cfstats_files, warnings, "missing cfstats") for warn in table_stats.add_stats_to_config(transformed_configs, cfstats_files): warnings.append(warn) return { "diag_dir": args.diag_dir, "warnings": warnings, "original_configs": node_configs, "configs": transformed_configs, "system_logs": system_logs, }
def parse(args): """read diag tarball""" #find output logs node_configs = node_env.initialize_node_configs(args.diag_dir) output_logs = diag.find_logs(args.diag_dir, args.output_log_prefix) #find system.logs system_logs = diag.find_logs(args.diag_dir, args.system_log_prefix) warnings = node_env.find_config_in_logs(node_configs, output_logs, system_logs) warn_missing(node_configs, output_logs, warnings, "missing output logs") warn_missing(node_configs, system_logs, warnings, "missing system logs") #find block dev node_info_list = diag.find_logs(args.diag_dir, args.node_info_prefix) if node_info_list: #only set block_dev_results if we find a single node_info.json with diag.FileWithProgress(node_info_list[0]) as node_info_json: #read all the block dev reports if node_info_json.error: warnings.append(node_info_json.error) block_dev_reports = diag.find_logs(args.diag_dir, args.block_dev_prefix) warn_missing(node_configs, block_dev_reports, warnings, "missing blockdev_reports") cass_drive_ra = read_ahead.get_cass_drive_read_ahead( node_info_json, block_dev_reports) read_ahead.add_block_dev_to_config(cass_drive_ra, node_configs) else: warnings.append("unable to read '%s'" % args.node_info_prefix) summary = [calculate(node_configs)] for warn in node_env.add_gc_to_configs(summary, system_logs): warnings.append(warn) #add cfstats if present cfstats_files = diag.find_logs(args.diag_dir, args.cfstats_prefix) warn_missing(node_configs, cfstats_files, warnings, "missing cfstats") for warn in table_stats.add_stats_to_config(summary, cfstats_files): warnings.append(warn) #use debug logs for statuslogger output on 5.1.17+, 6.0.10+, 6.7.5+ and 6.8+ debug_logs = diag.find_logs(args.diag_dir, args.debug_log_prefix) return { "diag_dir": args.diag_dir, "warnings": warnings, "configs": node_configs, "summary": summary[0], "rec_logs": system_logs + debug_logs, }