From 5b5b54c3c3128105bc86ebe7e92476cd86a5ec26 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 12 Jan 2023 16:08:31 -0500 Subject: [PATCH] Eliminate some duplicate output lines from xcatprobe osdeploy --- xCAT-probe/subcmds/osdeploy | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index afe461baa..a34869a09 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -812,15 +812,28 @@ Start capturing every message during OS provision process.... my @hdls; my $starttime = time(); my @candidate_mn_hostname_in_log = $log_parse->obtain_candidate_mn_hostname_in_log(); + my $log_content_ref_last; - #read log realtimely, then handle each log + # Loop forever, reading each log file for (; ;) { if (@hdls = $select->can_read(0)) { foreach my $hdl (@hdls) { my $line = ""; chomp($line = <$hdl>); my $log_content_ref = $log_parse->obtain_log_content($fd_filetype_map{$hdl}, $line); - dispatch_log_to_handler($log_content_ref, \@candidate_mn_hostname_in_log, \%node_state); + if ($log_content_ref->{label} == $::LOGLABEL_XCAT) { + # If reading computes or cluster log files, try to eliminate duplicated lines + unless (($log_content_ref_last->{time_record} eq $log_content_ref->{time_record}) && + ($log_content_ref_last->{sender} eq $log_content_ref->{sender}) && + ($log_content_ref_last->{msg} eq $log_content_ref->{msg})) { + dispatch_log_to_handler($log_content_ref, \@candidate_mn_hostname_in_log, \%node_state); + } + # Save messages details for later duplicate detection + $log_content_ref_last = { %$log_content_ref }; + } + else { + dispatch_log_to_handler($log_content_ref, \@candidate_mn_hostname_in_log, \%node_state); + } } }