A computer program product comprising a non-transitory processor-readable storage medium having stored therein program code of one or more software programs, wherein the program code when executed by at least one processing device causes said at least one processing device:
- to monitor, in real-time, by a system status monitoring module executing on at least one processing device obtaining system status values via system Application Programming Interfaces (APIs), at least one system status associated with an information system, wherein the information system comprises a plurality of system components including at least Central Processing Unit (CPU), memory, Input/Output (I/O), and capacity components;
- to determine, by a system anomaly detection module executing on the at least one processing device, a system score for the information system, based on a dynamic weighted calculation and an average performance evaluation across multiple time periods, wherein the system score facilitates predicting an impending error before the error occurs on the information system, wherein the dynamic weighted calculation comprises weighting the at least one system status by defining a risk level for the at least one system status using a risk level table mapping percentage ranges to risk levels, determining a percentage range for the at least one system status, and utilizing the risk level and the percentage range to determine a weight of the at least one system status, wherein the average performance evaluation comprises determining at least one periodic weight for the at least one system status, wherein the at least one periodic weigm represents the at least one system status usage percentage at a current time, a first prior time period, and a second prior time period, wherein the average performance evaluation analyzes whether system performance is increasing, decreasing. or steady. wherein determining the system score improves computer system reliability by enabling proactive error prevention that reduces system downtime and data loss;
- to determine, by a target component assignment module executing on the at least one processing device, a plurality of targeted components that require log collection based on the system score using a historical repository that maps risk levels of system statuses to specific system components by matching the risk level for the at least one system status to respective target components in the historical repository to identify the plurality of targeted components, wherein the plurality of system components comprises the plurality of targeted components, wherein the targeted component selection optimizes system performance by reducing computational load and conserving memory resources through selective log collection from only the targeted components, wherein a log collection optimization system comprises the system status monitoring module, the system anomaly detection module, and the target component assignment module;
- and
- in response to the system anomaly detection module determining that the system score exceeds a threshold, to trigger by the log collection optimization system a log collection module executing on the at least one processing device, to collect system log collection from only the targeted components executing on the information system before the error occurs on the information system, wherein the proactive targeted log collection prevents loss of critical diagnostic data that facilitates system recovery and root cause analysis.