An operation and maintenance log abnormality real-time detection method and system
By using semantically driven adaptive template induction and dynamic baseline tracking, the problem of static rules being unable to adapt to changes in the operation and maintenance environment is solved, enabling real-time anomaly detection and automated handling of operation and maintenance logs, and improving detection accuracy and response efficiency.
Patent Information
- Application Number
- CN202611368273.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-04
- Publication Date
- 2026-11-24
AI Technical Summary
In the existing operation and maintenance environment, static rules and fixed thresholds cannot adapt to the continuously changing log distribution patterns, resulting in false alarms and missed detections. The detection process and the handling process lack connection, resulting in low response efficiency.
It employs semantic-driven adaptive template induction and dynamic baseline tracking, and through distributed acquisition, pre-trained semantic coding network, incremental hierarchical clustering and sliding window deviation scoring, it achieves real-time identification and automatic adaptation of unknown anomalies, and integrates alarm and handling links.
It achieves accurate identification and automatic adaptation of unknown anomalies, reduces false alarm rate, shortens anomaly recovery time, and improves detection accuracy and response efficiency.
Smart Images

Figure CN123157499A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of IT intelligent operation and maintenance technology, specifically to a method and system for real-time detection of operation and maintenance log anomalies. Background Technology
[0002] With the widespread adoption of distributed architectures and microservices, the log data generated in operations and maintenance environments has experienced explosive growth in terms of source, format, and volume. Operations and maintenance log anomaly detection aims to promptly identify events deviating from normal operating patterns from massive log streams, providing a basis for fault location and emergency response. Existing solutions typically use predefined keyword matching rules or fixed regular expressions to screen log content, and use manually set static frequency thresholds or fixed statistical windows as anomaly judgment benchmarks, triggering alarms when the frequency of a certain type of log exceeds the threshold.
[0003] The above approach has a significant problem: the operational environment is constantly evolving. Service version iterations, configuration changes, and topology adjustments all alter the normal log distribution pattern, and static rules and fixed thresholds cannot adaptively adjust to keep pace with this evolution. Once a planned change occurs in the environment, the original baseline becomes disconnected from the actual log pattern, resulting in numerous false alarms. Furthermore, static matching methods cannot identify new anomaly patterns not covered in the rule base, leading to missed detections. There is a lack of a seamless connection between the detection process and subsequent alarm notifications and fault handling; manual intervention is still required after anomaly confirmation to initiate handling, resulting in a long response chain and low recovery efficiency. Summary of the Invention
[0004] This invention aims to provide a method and system for real-time detection of anomalies in operation and maintenance logs. Through semantic-driven adaptive template induction and dynamic baseline tracking, it can accurately identify unknown anomalies and automatically adapt to environmental evolution without the need for predefined rules. It also connects the detection, alarm and handling links to shorten the anomaly recovery time.
[0005] To achieve the above objectives, the technical solution adopted by this invention is: a method for real-time detection of anomalies in operation and maintenance logs, comprising: The distributed acquisition agent acquires multi-source heterogeneous operation and maintenance log streams in real time, performs format regularization and global time sequence arrangement on the multi-source heterogeneous operation and maintenance log streams, and outputs the log stream sequence. The logs in the log stream sequence are semantically vectorized and encoded using a pre-trained semantic coding network. The semantic similarity between log entries is calculated based on the encoding results, and incremental hierarchical clustering is performed to extract the log template set. The frequency distribution of each log template in the log template set is statistically analyzed, and the dynamically weighted baseline frequency value is calculated to generate a multi-granularity baseline set; The deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set is calculated using a sliding window method. Contextual verification is performed in conjunction with a cluster hierarchical tree, and a list of abnormal events is output. The list of abnormal events is classified into alarm levels and the detection results are pushed to the alarm platform to establish an alarm event file; The alarm event file is matched with the handling plan and the handling instructions are issued to execute automated handling.
[0006] Preferably, the step of acquiring multi-source heterogeneous operation and maintenance log streams in real time through a distributed acquisition agent includes: Deploy a collection agent process on each log-generating node in the operation and maintenance environment. The collection agent process continuously pulls new log data from the end of the log file in an append-only manner according to the path and frequency specified in the collection configuration file, and adds a local timestamp and a local monotonically increasing counter value to each log. The logs obtained by the data collection agent process are formatted and converted from plain text, structured key-value pair, and semi-structured markup language formats into a unified record format that includes time, severity, source component, message body, and extended fields. The log records with complete and standardized format are globally rearranged in time. They are initially sorted based on local timestamps. When the difference between the local timestamps of two log records is less than the clock skew tolerance threshold, they are sorted a second time based on the local monotonically increasing counter value, forming a log stream sequence arranged in ascending time. Log records that have completed global timing orchestration are allocated to high-priority buffer queues, medium-priority buffer queues, and low-priority buffer queues according to their severity level. The scheduler then retrieves log records from the three buffer queues in sequence according to a fixed rotation ratio and writes them to the log stream output channel.
[0007] Preferably, the step of using a pre-trained semantic coding network to perform semantic vectorization encoding on the logs in the log stream sequence includes: Each log message body is segmented to obtain a word sequence. Start and end markers are added to the beginning and end of the word sequence, respectively. The processed word sequence is input into a pre-trained semantic coding network, and the hidden layer output at the position corresponding to the end marker is taken as the semantic vector representation of the message body. For log records whose message body length exceeds the maximum input length of the network, a concatenation method is adopted, which retains half the length of words at the beginning and end and fills the middle with ellipsis markers; Perform an inner product operation on the semantic vectors of any two logs in the log stream, and divide by the product of the Euclidean norms of the two semantic vectors to obtain the semantic similarity with a value between negative one and positive one. The locality-sensitive hashing method is used to pre-filter semantic vectors by binning. Semantic similarity is calculated only for log pairs that fall into the same or adjacent bins, reducing the computational cost from the quadratic order of the total number of logs to approximately linear.
[0008] Preferably, the incremental hierarchical clustering operation includes an initial setup phase and an incremental update phase; In the initial setup phase, each log record forms a separate cluster. In each iteration, the two clusters with the highest semantic similarity are selected for merging. The similarity between the two clusters is measured by the average semantic similarity of all log pairs in the two clusters. The merging operation continues until the average semantic similarity between any two existing clusters is lower than the clustering termination threshold. During the merging process, the merging relationship of each layer is recorded to form a bottom-up cluster hierarchy tree. Each internal node in the cluster hierarchy tree is the parent cluster of its two child nodes. During the incremental update phase, whenever a new log record is added to the log stream, the similarity between the semantic vector of the new log record and the center vector of all existing clusters is calculated. If the maximum similarity is greater than or equal to the clustering termination threshold, the new log record is merged into the corresponding cluster and the cluster hierarchy tree is updated. If the maximum similarity is lower than the clustering termination threshold, a new cluster is created for the new log record and attached to the top layer of the cluster hierarchy tree as an independent leaf node. Every preset period, the agglomeration process is re-executed for all existing clusters to generate a new cluster hierarchy tree. The newly arrived log records during the recalculation are temporarily stored in the incremental buffer and the incremental merging is performed uniformly after the new cluster hierarchy tree is generated.
[0009] Preferably, the step of statistically analyzing the frequency distribution of each log template in the log template set and calculating the dynamically weighted baseline frequency value includes: Divide the timeline into equal-length statistical time slices, count the number of log records matched by each log template in each statistical time slice, divide by the duration of the statistical time slice to obtain the frequency of occurrence, and form a frequency matrix with log templates as rows and statistical time slices as columns. For logs whose semantic vectors have a similarity to the center vectors of all the clusters to which the templates belong that is lower than the clustering termination threshold, they are marked as unmatched logs and temporarily stored in the unmatched buffer, waiting for the incremental update phase to create new clusters and new templates. For each log template in the frequency matrix, a preset number of historical statistical time slices are traced back from the current baseline update time. The occurrence frequency of each historical statistical time slice is multiplied by the corresponding time decay weight, summed, and then divided by the sum of the time decay weights to obtain the dynamic weighted baseline frequency value. The time decay weight is calculated by taking the negative exponent of the square of the difference between the current baseline update time and the center time of the historical statistical time slice, so that historical data closer to the current time contributes more to the baseline, while the contribution of historical data farther away approaches zero according to the decay curve; for log templates that appear with a frequency of zero in the backtracking window, the dynamic weighted baseline frequency value is set to zero and marked as silent. The baseline is triggered to roll over at a fixed interval consistent with the sliding window step size. During each update, the dynamic weighted baseline frequency value of all log templates is recalculated and the original baseline is replaced to ensure that each new sliding window position uses the latest updated baseline value.
[0010] Preferably, the step of statistically analyzing the frequency distribution of each log template in the log template set and calculating the dynamically weighted baseline frequency value further includes change awareness judgment, specifically including: If the baseline frequency value of a log template that exceeds a preset proportion changes by more than a preset threshold within multiple consecutive update cycles, it is determined that the current period is in a change transition period. The time decay width parameter in the time decay weight is temporarily shortened to enable the baseline to track the changed log pattern faster. Once the baseline change amplitude falls back to the preset range within multiple consecutive update cycles, the time decay width parameter is restored to its original value. The generated multi-granularity baseline set includes: the first granularity is the dynamically weighted baseline frequency value at the level of a single statistical time slice, used to capture frequency fluctuations within a short period; the second granularity is the arithmetic mean of the dynamically weighted baseline frequency values of multiple consecutive statistical time slices, used to reflect the medium-term trend; the third granularity is the arithmetic mean of the second granularity baselines over multiple consecutive hours, used to characterize the daytime steady-state level of the log pattern; the baselines of the three granularities are organized into a baseline table indexed by the log template number.
[0011] Preferably, the step of calculating the deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set using a sliding window method, and performing contextual verification in conjunction with a cluster hierarchy tree, includes: Construct a sliding window observation sequence. The length of the sliding window is set according to the number of statistical time slices, and the sliding step is set to one statistical time slice. Whenever a complete statistical time slice of log data is added to the log stream output channel, the sliding window slides forward one time slice. For each statistical time slice in the window, the number of log records matched by each log template is counted and divided by the time slice length to obtain the actual observation frequency. For each log template, a deviation score is calculated. The deviation score is the absolute value of the difference between the actual observation frequency at the current moment and the frequency value of the first granularity baseline in the multi-granularity baseline set, divided by the sample standard deviation of the historical observation frequencies within the window, where the update time of the first granularity baseline frequency value is aligned with the current time of the sliding window. The summation range only includes historical time slices prior to the current moment and does not include the current moment itself, in order to avoid the current observation appearing in both the numerator and denominator, which would cause extreme outliers to self-dilution. The calculation of the sample standard deviation introduces a minimum positive constant dynamically set based on the historical frequency mean of the log template to prevent the denominator from being zero. When the historical frequency mean is large, the minimum positive constant increases accordingly, and when the historical frequency mean is small, the minimum positive constant returns to the lower limit. For log templates whose deviation scores exceed the initial threshold, contextual verification is performed. The parent cluster of the cluster to which the suspicious log template belongs and all sibling clusters under the parent cluster except the current cluster are retrieved in the cluster hierarchy tree. The log templates corresponding to the sibling clusters are checked to see if there are significant changes in the same or opposite directions within the same time slice. If at least one template in the sibling cluster has a deviation score that exceeds the association threshold, the deviation event is confirmed. If the deviation scores of all templates in the sibling cluster do not exceed the association threshold, the event is marked as pending observation. Deviation events in the pending observation state have their deviation scores recalculated in subsequent sliding window steps. If the deviation score falls below the initial threshold within multiple consecutive window steps, the suspicious flag is removed. If the deviation score still exceeds the initial threshold within multiple consecutive window steps, the event is upgraded to confirmed anomaly.
[0012] Preferably, the step of classifying alarm levels and pushing the detection results to the alarm platform includes: The final alarm level is determined by adding two additional dimensions based on the initial severity level assessment: The first additional dimension is the importance of the source component. The importance of the source component is determined based on the service level marker in the operation and maintenance topology. The alarm level corresponding to the core business service is upgraded by one level, while the initial judgment level of the auxiliary support service remains unchanged. The second additional dimension is the duration of the abnormal event over time. If a deviation event of the same log template persists within multiple consecutive sliding window steps, the alarm level will be increased by one level; the alarm level increase is capped at the urgency level. For each abnormal log event, generate structured alarm information. The structured alarm information includes the unique identifier number of the alarm event, the time of alarm occurrence, the final alarm level, the deviation score value, the deviation direction, the list of associated template numbers, the name of the source component, and the log context fragments before and after the abnormality occurred. Based on the final alarm level, a multi-channel push is executed, including the application interface channel of the alarm platform, the instant messaging channel, and the SMS channel. Each alarm message body is pushed with a push receipt request. If no confirmation receipt is received after the receipt waiting time, a resend operation is automatically triggered. An alarm event file is created for each abnormal log event in the alarm platform. Alarm event files with a final alarm level of severe or urgent will automatically trigger an automated handling process after creation. Alarm event files with a final alarm level of prompt or warning will only be retained as records.
[0013] Preferably, the process of matching the contingency plan and issuing contingency instructions to execute automated contingency measures includes: Based on the analysis of alarm event files, the anomaly type and impact scope are determined. The anomaly type is determined according to the deviation direction and the log template involved, and is divided into service unreachable, service error surge, resource exhaustion warning and general anomaly. The impact scope is extended to the upstream and downstream of the operation and maintenance topology by a preset number of hops from the source component, and all components extended to are included in the impact scope list. The system filters applicable emergency response plans from the emergency response plan library based on the anomaly type, and then performs a second filtering based on the number and type of components in the impact scope list to select the emergency response plan with the highest degree of matching. If no matching emergency response plan is found in the emergency response plan library, a manual intervention request is generated and pushed to the instant messaging channel of the operation and maintenance personnel on duty. The sequence of actions in the emergency response plan is converted into action instructions one by one according to the execution order and sent to the target maintenance object. Each action instruction includes the identifier of the target maintenance object, the operation type, the operation parameters, and the rollback conditions. For abnormal events with an emergency alarm level, handling instructions that do not have a sequential dependency are issued in parallel to shorten the total handling time, while handling instructions that have a sequential dependency are issued sequentially. If a handling instruction fails after execution and meets the rollback conditions, the corresponding rollback action is executed and the issuance of subsequent instructions is terminated. Based on the execution results of the handling instructions, a handling report is generated and written to the operation and maintenance event log database. The handling report includes the unique identifier number of the alarm event that triggered the handling, the anomaly type, the list of affected areas, the matching handling plan number, the issuance time and execution result of each handling instruction. The handling report and the alarm event file are linked through the unique identifier number of the alarm event to form a complete event chain record.
[0014] On the other hand, this invention proposes a real-time anomaly detection system for operation and maintenance logs, comprising: The log collection module is used to acquire multi-source heterogeneous operation and maintenance log streams in real time through a distributed collection agent, perform format regularization and global time sequence arrangement on the multi-source heterogeneous operation and maintenance log streams, and output the log stream sequence. The semantic parsing and template clustering module is used to perform semantic vectorization encoding on the logs in the log stream sequence using a pre-trained semantic coding network, calculate the semantic similarity between log entries based on the encoding results, perform incremental hierarchical clustering operations, and extract the log template set. The dynamic baseline generation module is used to statistically analyze the frequency distribution of each log template in the log template set and calculate the dynamic weighted baseline frequency value to generate a multi-granularity baseline set. The sliding window anomaly detection module is used to calculate the deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set using a sliding window method, perform context association verification in combination with the cluster hierarchy tree, and output a list of anomalies. The alarm push module is used to classify the list of abnormal events into alarm levels and push the detection results to the alarm platform to establish an alarm event file; The automated handling module is used to match the handling plan with the alarm event file and issue handling instructions to execute automated handling.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention utilizes a pre-trained semantic coding network to semantically vectorize and encode logs. It automatically summarizes and continuously tracks log templates through incremental hierarchical clustering, covering unknown anomaly patterns without relying on predefined rules, thus reducing missed detections. Based on frequency statistics, it calculates dynamically weighted baseline frequency values and generates a multi-granularity baseline set, enabling the baseline to continuously and adaptively update with the normal evolution of the operational environment, avoiding false alarms caused by planned changes. It employs a sliding window to calculate deviation scores and combines them with cluster hierarchical trees for contextual verification, filtering out isolated statistical fluctuations and further improving the accuracy of anomaly detection. After detection output, it directly connects to alarm level classification, alarm platform push, and handling plan matching and distribution, connecting the entire chain from anomaly identification to automated handling, reducing manual waiting time and shortening anomaly recovery time. Attached Figure Description
[0016] Figure 1 This is a flowchart of the real-time detection method for anomalies in operation and maintenance logs according to the present invention; Figure 2 This is a block diagram of the real-time anomaly detection system for operation and maintenance logs of the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0018] It should be noted that if the embodiments of the present invention involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a specific posture. If the specific posture changes, the directional indicators will also change accordingly.
[0019] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the use of "and / or" or "and / or" throughout the text includes three parallel solutions. For example, "A and / or B" includes solution A, solution B, or a solution where both A and B are satisfied simultaneously. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0020] Please see Figure 1 This invention provides a technical solution: a method for real-time detection of anomalies in operation and maintenance logs, comprising: The distributed acquisition agent acquires multi-source heterogeneous operation and maintenance log streams in real time, performs format regularization and global time sequence arrangement on the multi-source heterogeneous operation and maintenance log streams, and outputs the log stream sequence. This includes acquiring multi-source heterogeneous operation and maintenance log streams in real time through a distributed acquisition agent, including: Deploy a collection agent process on each log-generating node in the operation and maintenance environment. The collection agent process continuously pulls new log data from the end of the log file in an append-only manner according to the path and frequency specified in the collection configuration file, and adds a local timestamp and a local monotonically increasing counter value to each log. The logs obtained by the data collection agent process are formatted and converted from plain text, structured key-value pair, and semi-structured markup language formats into a unified record format that includes time, severity, source component, message body, and extended fields. The log records with complete and standardized format are globally rearranged in time. They are initially sorted based on local timestamps. When the difference between the local timestamps of two log records is less than the clock skew tolerance threshold, they are sorted a second time based on the local monotonically increasing counter value, forming a log stream sequence arranged in ascending time. Log records that have completed global timing orchestration are allocated to high-priority buffer queues, medium-priority buffer queues, and low-priority buffer queues according to their severity level. The scheduler then retrieves log records from the three buffer queues in sequence according to a fixed rotation ratio and writes them to the log stream output channel.
[0021] By unifying the format and accommodating clock skew, the problem of disordered order in multi-source logs can be alleviated to some extent. Furthermore, hierarchical scheduling enables important logs to be processed relatively promptly, providing a reliable and consistent data foundation for subsequent analysis.
[0022] The logs in the log stream sequence are semantically vectorized and encoded using a pre-trained semantic coding network. The semantic similarity between log entries is calculated based on the encoding results, and incremental hierarchical clustering is performed to extract the log template set. The process of semantically vectorizing the logs in the log stream sequence using a pre-trained semantic coding network includes: Each log message body is segmented to obtain a word sequence. Start and end markers are added to the beginning and end of the word sequence, respectively. The processed word sequence is input into a pre-trained semantic coding network, and the hidden layer output at the position corresponding to the end marker is taken as the semantic vector representation of the message body. For log records whose message body length exceeds the maximum input length of the network, a concatenation method is adopted, which retains half the length of words at the beginning and end and fills the middle with ellipsis markers; the semantic vectors of any two logs in the log stream are subjected to inner product operation, and divided by the product of the Euclidean norms of the two semantic vectors to obtain the semantic similarity with a value between negative one and positive one. The locality-sensitive hashing method is used to pre-filter semantic vectors by binning. Semantic similarity is calculated only for log pairs that fall into the same or adjacent bins, reducing the computational cost from the quadratic order of the total number of logs to approximately linear.
[0023] By using semantic vectorization and locality-sensitive hashing pre-screening, the efficiency and accuracy of log template extraction can be improved to a certain extent, making it easier to merge logs with similar meanings, while alleviating the problem of excessive similarity calculation overhead in large-scale log scenarios.
[0024] Furthermore, the incremental hierarchical clustering operation includes an initial setup phase and an incremental update phase; In the initial setup phase, each log record forms a separate cluster. In each iteration, the two clusters with the highest semantic similarity are selected for merging. The similarity between the two clusters is measured by the average semantic similarity of all log pairs in the two clusters. The merging operation continues until the average semantic similarity between any two existing clusters is lower than the clustering termination threshold. During the merging process, the merging relationship of each layer is recorded to form a bottom-up cluster hierarchy tree. Each internal node in the cluster hierarchy tree is the parent cluster of its two child nodes. During the incremental update phase, whenever a new log record is added to the log stream, the similarity between the semantic vector of the new log record and the center vector of all existing clusters is calculated. If the maximum similarity is greater than or equal to the clustering termination threshold, the new log record is merged into the corresponding cluster and the cluster hierarchy tree is updated. If the maximum similarity is lower than the clustering termination threshold, a new cluster is created for the new log record and attached to the top layer of the cluster hierarchy tree as an independent leaf node. Every preset period, the agglomeration process is re-executed for all existing clusters to generate a new cluster hierarchy tree. The newly arrived log records during the recalculation are temporarily stored in the incremental buffer and the incremental merging is performed uniformly after the new cluster hierarchy tree is generated.
[0025] By combining incremental updates with periodic reconstruction, the real-time performance and structural stability of log template clustering can be balanced to a certain extent, enabling newly arriving logs to be quickly assigned to appropriate clusters, while mitigating the hierarchical tree degradation problem that may result from long-term incremental accumulation.
[0026] The frequency distribution of each log template in the log template set is statistically analyzed, and the dynamically weighted baseline frequency value is calculated to generate a multi-granularity baseline set; This includes statistically analyzing the frequency distribution of each log template in the log template set and calculating the dynamically weighted baseline frequency value, including: Divide the timeline into equal-length statistical time slices, count the number of log records matched by each log template in each statistical time slice, divide by the duration of the statistical time slice to obtain the frequency of occurrence, and form a frequency matrix with log templates as rows and statistical time slices as columns. For logs whose semantic vectors have a similarity to the center vectors of all the clusters to which the templates belong that is lower than the clustering termination threshold, they are marked as unmatched logs and temporarily stored in the unmatched buffer, waiting for the incremental update phase to create new clusters and new templates. For each log template in the frequency matrix, a preset number of historical statistical time slices are traced back from the current baseline update time. The occurrence frequency of each historical statistical time slice is multiplied by the corresponding time decay weight, summed, and then divided by the sum of the time decay weights to obtain the dynamic weighted baseline frequency value. The time decay weight is calculated by taking the negative exponent of the square of the difference between the current baseline update time and the center time of the historical statistical time slice, so that historical data closer to the current time contributes more to the baseline, while the contribution of historical data farther away approaches zero according to the decay curve; for log templates that appear with a frequency of zero in the backtracking window, the dynamic weighted baseline frequency value is set to zero and marked as silent. The baseline is triggered to roll over at a fixed interval consistent with the sliding window step size. During each update, the dynamic weighted baseline frequency value of all log templates is recalculated and the original baseline is replaced to ensure that each new sliding window position uses the latest updated baseline value.
[0027] Further, this includes change perception and judgment, specifically including: If the baseline frequency value of a log template that exceeds a preset proportion changes by more than a preset threshold within multiple consecutive update cycles, it is determined that the current period is in a change transition period. The time decay width parameter in the time decay weight is temporarily shortened to enable the baseline to track the changed log pattern faster. Once the baseline change amplitude falls back to the preset range within multiple consecutive update cycles, the time decay width parameter is restored to its original value. The generated multi-granularity baseline set includes: the first granularity is the dynamically weighted baseline frequency value at the level of a single statistical time slice, used to capture frequency fluctuations within a short period; the second granularity is the arithmetic mean of the dynamically weighted baseline frequency values of multiple consecutive statistical time slices, used to reflect the medium-term trend; the third granularity is the arithmetic mean of the second granularity baselines over multiple consecutive hours, used to characterize the daytime steady-state level of the log pattern; the baselines of the three granularities are organized into a baseline table indexed by the log template number.
[0028] By using a dynamic weighted baseline and a multi-granularity organization method, the sensitivity of the log frequency baseline to recent changes and the smooth representation of long-term steady state can be balanced to a certain extent. This allows anomaly detection to capture short-term fluctuations in a timely manner and is less prone to false alarms due to occasional jitter. At the same time, the change-aware mechanism adaptively adjusts the baseline tracking speed, which helps to alleviate the detection bias caused by baseline lag during system upgrades or configuration changes.
[0029] A sliding window approach is used to calculate the deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set. Contextual verification is performed using a cluster hierarchy tree, and a list of anomalous events is output. Specifically, this includes: Construct a sliding window observation sequence. The length of the sliding window is set according to the number of statistical time slices, and the sliding step is set to one statistical time slice. Whenever a complete statistical time slice of log data is added to the log stream output channel, the sliding window slides forward one time slice. For each statistical time slice in the window, the number of log records matched by each log template is counted and divided by the time slice length to obtain the actual observation frequency. For each log template, a deviation score is calculated. The deviation score is the absolute value of the difference between the actual observation frequency at the current moment and the frequency value of the first granularity baseline in the multi-granularity baseline set, divided by the sample standard deviation of the historical observation frequencies within the window, where the update time of the first granularity baseline frequency value is aligned with the current time of the sliding window. The summation range only includes historical time slices prior to the current moment and does not include the current moment itself, in order to avoid the current observation appearing in both the numerator and denominator, which would cause extreme outliers to self-dilution. The calculation of the sample standard deviation introduces a minimum positive constant dynamically set based on the historical frequency mean of the log template to prevent the denominator from being zero. When the historical frequency mean is large, the minimum positive constant increases accordingly, and when the historical frequency mean is small, the minimum positive constant returns to the lower limit. For log templates whose deviation scores exceed the initial threshold, contextual verification is performed. The parent cluster of the cluster to which the suspicious log template belongs and all sibling clusters under the parent cluster except the current cluster are retrieved in the cluster hierarchy tree. The log templates corresponding to the sibling clusters are checked to see if there are significant changes in the same or opposite directions within the same time slice. If at least one template in the sibling cluster has a deviation score that exceeds the association threshold, the deviation event is confirmed. If the deviation scores of all templates in the sibling cluster do not exceed the association threshold, the event is marked as pending observation. Deviation events in the pending observation state have their deviation scores recalculated in subsequent sliding window steps. If the deviation score falls below the initial threshold within multiple consecutive window steps, the suspicious flag is removed. If the deviation score still exceeds the initial threshold within multiple consecutive window steps, the event is upgraded to confirmed anomaly.
[0030] By combining sliding window deviation scoring with contextual verification, the robustness of log anomaly detection can be improved to a certain extent, making it easier to identify real anomalies. At the same time, cross-validation of sibling cluster change information reduces false alarms caused by isolated fluctuations, and the observation and subsequent window review mechanism provides a gentler judgment process for short-term jitter or gradual anomalies.
[0031] The list of abnormal events is classified into alarm levels and the detection results are pushed to the alarm platform to establish an alarm event file; The process of classifying alarm levels and pushing the detection results to the alarm platform includes: adding two additional dimensions to the initial severity level assessment to determine the final alarm level classification. The first additional dimension is the importance of the source component. The importance of the source component is determined based on the service level marker in the operation and maintenance topology. The alarm level corresponding to the core business service is upgraded by one level, while the initial judgment level of the auxiliary support service remains unchanged. The second additional dimension is the duration of the abnormal event over time. If a deviation event of the same log template persists within multiple consecutive sliding window steps, the alarm level will be increased by one level; the alarm level increase is capped at the urgency level. For each abnormal log event, generate structured alarm information. The structured alarm information includes the unique identifier number of the alarm event, the time of alarm occurrence, the final alarm level, the deviation score value, the deviation direction, the list of associated template numbers, the name of the source component, and the log context fragments before and after the abnormality occurred. Based on the final alarm level, a multi-channel push is executed, including the application interface channel of the alarm platform, the instant messaging channel, and the SMS channel. Each alarm message body is pushed with a push receipt request. If no confirmation receipt is received after the receipt waiting time, a resend operation is automatically triggered. An alarm event file is created for each abnormal log event in the alarm platform. Alarm event files with a final alarm level of severe or urgent will automatically trigger an automated handling process after creation. Alarm event files with a final alarm level of prompt or warning will only be retained as records.
[0032] By combining multi-dimensional classification of component importance and anomaly persistence with a multi-channel reliable push mechanism, the rationality of alarm classification and the timeliness of notification can be improved to a certain extent, enabling critical anomalies to receive higher priority responses. At the same time, with the help of structured files and hierarchical handling strategies, both operational efficiency and information traceability can be taken into account, avoiding excessive interference from low-level events.
[0033] Based on the alarm event file, a handling plan is matched and a handling instruction is issued to execute automated handling; specifically including: Based on the analysis of alarm event files, the anomaly type and impact scope are determined. The anomaly type is determined according to the deviation direction and the log template involved, and is divided into service unreachable, service error surge, resource exhaustion warning and general anomaly. The impact scope is extended to the upstream and downstream of the operation and maintenance topology by a preset number of hops from the source component, and all components extended to are included in the impact scope list. The system filters applicable emergency response plans from the emergency response plan library based on the anomaly type, and then performs a second filtering based on the number and type of components in the impact scope list to select the emergency response plan with the highest degree of matching. If no matching emergency response plan is found in the emergency response plan library, a manual intervention request is generated and pushed to the instant messaging channel of the operation and maintenance personnel on duty. The sequence of actions in the emergency response plan is converted into action instructions one by one according to the execution order and sent to the target maintenance object. Each action instruction includes the identifier of the target maintenance object, the operation type, the operation parameters, and the rollback conditions. For abnormal events with an emergency alarm level, handling instructions that do not have a sequential dependency are issued in parallel to shorten the total handling time, while handling instructions that have a sequential dependency are issued sequentially. If a handling instruction fails after execution and meets the rollback conditions, the corresponding rollback action is executed and the issuance of subsequent instructions is terminated. Based on the execution results of the handling instructions, a handling report is generated and written to the operation and maintenance event log database. The handling report includes the unique identifier number of the alarm event that triggered the handling, the anomaly type, the list of affected areas, the matching handling plan number, the issuance time and execution result of each handling instruction. The handling report and the alarm event file are linked through the unique identifier number of the alarm event to form a complete event chain record.
[0034] By jointly analyzing anomaly types and impact scope, and through multi-level screening and matching of contingency plan databases, the targeting and adaptability of automated handling can be improved to a certain extent, reducing the risk of misoperation. The combination of parallel and serial deployment strategies helps to shorten the handling time of emergency events while ensuring the correctness of dependencies, while rollback conditions and failure termination mechanisms provide a certain safety net for the handling process. When contingency plans are missing, timely intervention by humans is provided, avoiding the secondary impact that may be caused by blind execution. Finally, the handling report and alarm files are linked through a unified identifier, which facilitates post-event review and continuous optimization.
[0035] On the other hand, this invention proposes a real-time anomaly detection system for operation and maintenance logs, such as... Figure 2 As shown, it includes: The log collection module is used to acquire multi-source heterogeneous operation and maintenance log streams in real time through a distributed collection agent, perform format regularization and global time sequence arrangement on the multi-source heterogeneous operation and maintenance log streams, and output the log stream sequence. The semantic parsing and template clustering module is used to perform semantic vectorization encoding on the logs in the log stream sequence using a pre-trained semantic coding network, calculate the semantic similarity between log entries based on the encoding results, perform incremental hierarchical clustering operations, and extract the log template set. The dynamic baseline generation module is used to statistically analyze the frequency distribution of each log template in the log template set and calculate the dynamic weighted baseline frequency value to generate a multi-granularity baseline set. The sliding window anomaly detection module is used to calculate the deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set using a sliding window method, perform context association verification in combination with the cluster hierarchy tree, and output a list of anomalies. The alarm push module is used to classify the list of abnormal events into alarm levels and push the detection results to the alarm platform to establish an alarm event file; The automated handling module is used to match the handling plan with the alarm event file and issue handling instructions to execute automated handling.
[0036] Furthermore, the modules in the above system also perform other steps to implement the aforementioned method for real-time detection of anomalies in operation and maintenance logs, as follows: Step 1: Obtain multi-source heterogeneous operation and maintenance log streams in real time through a distributed acquisition agent; The core task of this step is to deploy a set of distributed data collection agent nodes in the operations and maintenance environment to aggregate operations and maintenance logs from different sources and in different formats into a standardized log stream that can be processed later; specifically, this includes: Step 1.1: Deploy the data collection agent process on each log-generating node in the operation and maintenance environment.
[0037] Each data collection agent process runs in a resident daemon mode on the local machine of the corresponding log generation node. It continuously acquires the raw log data generated by the node by reading local log files, listening to system log sockets, and subscribing to log topics in the message queue.
[0038] The data collection agent loads a data collection configuration file upon startup. This configuration file records the list of log paths to be collected by this node, log rotation rules, maximum collection frequency, and log source type identifiers. The data collection agent continuously pulls new content from the end of the log file according to the paths and frequencies specified in the configuration file, appending to it. For logs from sockets and message queues, it receives them in real-time using an event-driven approach.
[0039] After each acquisition agent process obtains a raw log, it immediately appends a local timestamp and a local monotonically increasing counter value to it. The timestamp is taken from the system clock synchronized by the network time protocol of this node, with a time resolution of milliseconds. The counter value is maintained by the acquisition agent process of this node and increments by 1 for each log generated, in order to provide a deterministic order in the extreme case of identical timestamps.
[0040] Step 1.2: Based on the raw logs obtained by each collection agent process, perform format regularization and field standardization.
[0041] Because logs from different sources differ significantly in encoding methods, field separators, time formats, severity level indicators, etc., the collection agent process completes the first layer of normalization locally.
[0042] Specifically, for logs in plain text format, the collection agent process splits them into four standard fields based on predefined regular expression templates: time field, severity level field, source component field, and message body field. For logs that are already in structured key-value pair format, the collection agent process maps the key-value pairs that correspond to the semantics of the standard fields to unified field names, and retains the key-value pairs that cannot be mapped in the extended fields; For logs in semi-structured markup language format, the data collection agent process parses the tag hierarchy and extracts the tag content corresponding to the standard fields to fill in the unified fields.
[0043] After formatting, each log entry is converted into a unified record format containing five standard slots: time field, severity level field, source component field, message body field, and extended fields.
[0044] Step 1.3: Based on the completed and well-formatted log records, perform time-series marking and global sequence arrangement.
[0045] Since the local clocks of each node in the operation and maintenance environment may have slight deviations, and the network transmission delays of logs from different collection agent processes to the central aggregation node are different, it is necessary to perform global time-series rearrangement of log records from each collection agent process at the central aggregation node.
[0046] After receiving the log records reported by each collection agent process, the central aggregation node first performs preliminary sorting based on the local timestamp carried by each record; When the difference between the local timestamps of two log records is less than the clock skew tolerance threshold of 50 milliseconds, they are sorted a second time by the local monotonically increasing counter values maintained by each collection agent process in step 1.1, with the smaller counter value placed first. When the timestamp difference is greater than or equal to 50 milliseconds, the order is determined directly by the timestamp size. After global time-series rearrangement, all log records form a single log stream sequence arranged in ascending order of time.
[0047] Step 1.4: Based on the log stream sequence of global time-series orchestration, allocate buffer queues according to priority and output them to downstream processing stages.
[0048] The allocation of buffer queues is based on the severity level field and the source component field of each log record. In this embodiment, the severity level is divided into five levels: critical, error, warning, notification, and debug. Log records of the critical and error levels are allocated to the high-priority buffer queue, log records of the warning level are allocated to the medium-priority buffer queue, and log records of the notification and debug levels are allocated to the low-priority buffer queue.
[0049] The central aggregation node maintains a scheduler that sequentially retrieves log records from three buffer queues according to a fixed rotation ratio of high, medium, and low priority (3:2:1 in this embodiment) and writes them to the same log stream output channel. That is, in each round of scheduling, the scheduler first retrieves 3 records from the high-priority queue, then 2 records from the medium-priority queue, and finally 1 record from the low-priority queue, repeating this process until all queues are empty.
[0050] Each buffer queue is set with a maximum capacity limit (10,000 records in this example). When the number of log records in the queue reaches the limit, newly arrived log records of the same priority will overwrite the earliest written record in the queue to prevent the queue from expanding indefinitely and causing memory overflow.
[0051] Step 2: Perform semantic parsing and template clustering based on the log stream output from Step 1; This step takes the standardized log stream output from step one as input, uses a pre-trained semantic coding network to perform semantic vectorization representation of the message text of each log, calculates the semantic similarity between log entries, and then performs incremental hierarchical clustering to group semantically similar logs into the same category. Finally, representative log templates are extracted from each category, while preserving the hierarchical relationship between clusters. Specifically, this includes: Step 2.1: Based on the log stream output from Step 1, perform semantic vectorization encoding on the message body field of each log record.
[0052] The pre-trained semantic encoding network is a deep bidirectional encoding network pre-trained on a large-scale general corpus. Its input is a piece of natural language text, and its output is a dense vector of fixed dimensions. In this embodiment, the output vector dimension of the network is set to 768 dimensions. The specific encoding process is as follows: First, the message body of each log is segmented into words to obtain a word sequence. Then, start and end markers are added to the beginning and end of the word sequence, respectively. Next, the processed word sequence is input into a pre-trained semantic coding network. After multiple layers of self-attention operations and feedforward transformations within the network, the hidden layer output at the position corresponding to the end marker is taken as the semantic vector representation of the log message body.
[0053] For log records whose message body length exceeds the maximum network input length (512 tokens in this embodiment), a concatenation method is adopted, retaining 256 tokens at the beginning and end, and filling the middle with ellipsis markers, to take into account the contextual information at the beginning of the log and the exception stack or error code information at the end. After processing, each log record in the log stream output from step one obtains a 768-dimensional semantic vector.
[0054] Step 2.2: Calculate the semantic similarity between each pair of log entries based on the semantic vector of each log entry.
[0055] For the i-th and j-th log entries in the log stream, their semantic vectors are denoted as follows: and The semantic similarity between the two Calculate using the following formula: (1); in, Represents the semantic vector of the i-th log entry. The kth component, Represents the semantic vector of the j-th log entry. The k-th component, where k is an integer from 1 to 768.
[0056] The numerator is the inner product of two 768-dimensional vectors, calculated by multiplying corresponding components one by one and then summing the results. Its dimension is the square of the vector component units. The denominator is the product of the Euclidean norms of the two vectors, also with the dimension of the square of the vector component units. Therefore... It is a dimensionless scalar, with a value range from -1 to +1.
[0057] when When the value is close to +1, it indicates that the two log entries are semantically very similar. when When the value is close to 0, it indicates that the two are semantically unrelated. when When the value is close to -1, it indicates that the semantic directions of the two are opposite.
[0058] like or If the vector is zero (i.e., all components are 0), then the denominator is 0. In this case, simply let... This indicates that there is no measurable semantic association between this log entry and any other log entry, and it will be grouped into a separate cluster in subsequent clustering.
[0059] In actual calculations, to avoid excessive overhead for pairwise calculations due to the large size of the log stream, the local sensitive hashing method is used to pre-filter semantic vectors by bucketing. The similarity in formula (1) is calculated only for log pairs that fall into the same bucket or adjacent buckets, thereby reducing the computational load from the quadratic level of the total number of logs to approximately linear.
[0060] Step 2.3: Based on semantic similarity scores, perform incremental hierarchical clustering on the log entries in the log stream. Clustering is divided into an initial setup phase and an incremental update phase.
[0061] The initial setup phase is executed once during the first deployment of the system, using a bottom-up, cohesive approach: Initially, each log record forms its own separate cluster. In each iteration, the two clusters with the highest semantic similarity among all existing cluster pairs are selected and merged. The similarity between the two clusters is measured by the mean of the semantic similarity of all log pairs in the two clusters. The merging operation continues until the average semantic similarity between any two existing clusters is below the clustering termination threshold of 0.72. During the merging process, the merging relationship at each level is recorded, forming a bottom-up cluster hierarchy tree. Each internal node in the tree represents a merging operation, and its two child nodes are the two clusters being merged. The internal node is the parent cluster of the child nodes.
[0062] After the initial setup is completed, the incremental update phase begins: whenever a new log record is added to the log stream in step one, the similarity between the semantic vector of the log record and the center vector of all existing clusters is calculated. If the maximum similarity is greater than or equal to 0.72, the log record is merged into the corresponding cluster, and the center vector of the cluster and the list of leaf nodes of the cluster in the cluster hierarchy tree are updated. If the maximum similarity is less than 0.72, a new cluster is created for the log entry, and this new cluster is attached as an independent leaf node to the top level of the cluster hierarchy tree.
[0063] In addition, to prevent the clustering results from gradually becoming invalid due to long-term drift of log patterns, a recalculation is performed on all existing clusters every 24 hours: the leaf node logs of all clusters are retrieved, the agglomeration process of the initial establishment phase is re-executed, a new cluster hierarchy tree is generated, and the old cluster hierarchy tree is replaced.
[0064] During the recalculation process, newly arriving log records in the log stream of step one are temporarily stored in the incremental buffer. After the new cluster hierarchy tree is generated, the incremental incorporation operation is then performed on all log records in the incremental buffer.
[0065] After processing, all log records in the log stream are divided into several non-overlapping clusters. The logs within each cluster have high semantic consistency, while the logs between different clusters are clearly distinguishable semantically. At the same time, the cluster hierarchy tree retains the complete parent-child relationship.
[0066] Step 2.4: Based on the clustering results and the cluster hierarchy tree, extract representative log templates from each cluster.
[0067] For each cluster, the log record with the smallest distance between the semantic vector and the cluster center vector is selected as the representative log of the cluster. The variable parts in its message body (such as specific values, network addresses, process IDs, timestamp strings, etc.) are replaced with wildcard placeholders to obtain the log template corresponding to the cluster.
[0068] The identification of variable parts is accomplished by the following rules: consecutive sequences of numeric characters are replaced with numeric placeholders, combinations of numbers and dots that conform to network address format are replaced with address placeholders, strings that conform to hexadecimal encoding format are replaced with encoding placeholders, and the rest of the text remains unchanged.
[0069] After processing, each log pattern category corresponds to a log template. All log templates, together with their respective cluster numbers, parent cluster numbers in the cluster hierarchy tree, and cluster center vectors, constitute a log template set.
[0070] Step 3: Dynamically generate a log pattern baseline based on the log template extracted in Step 2; This step takes the log template set output from step two as input, calculates the frequency distribution of each log template over time, and then calculates a weighted baseline frequency value. Finally, it generates a multi-granularity baseline set that reflects the normal fluctuation range of log patterns through periodic rolling updates. Specifically, this includes: Step 3.1: Based on the log template set output in Step 2, calculate the frequency distribution of each log template over time.
[0071] For each newly arrived log record in the continuously output log stream from step one, first match its message body with all templates in the log template set: Calculate the cosine similarity between the semantic vector of the log and the center vector of the cluster to which each template belongs (the calculation method is the same as formula (1) in step 2.2). If the maximum similarity is greater than or equal to 0.72, the log is determined to be a successful match and is assigned to the corresponding template. If all similarities are less than 0.72, the log is marked as an unmatched log and temporarily stored in the unmatched buffer, waiting for the incremental update stage in step 2.3 to create a new cluster and a new template for it.
[0072] For a successfully matched log record, the timestamp carried by that log record in the log stream output from step one is used as the basis for including it in the corresponding statistical time slice. The time axis is divided into statistical time slices of equal length, and the length of each statistical time slice is set to 60 seconds in this embodiment.
[0073] For each log template, count the number of log records matched within each statistical time slice, divide by the duration of the statistical time slice (60 seconds), and obtain the frequency of occurrence of the log template within that statistical time slice, in units of records per second.
[0074] By sequentially traversing all templates in the log template set and all statistical time slices in the log stream, a frequency matrix is obtained, with log templates as rows and statistical time slices as columns. This frequency matrix reflects the rhythm and fluctuation characteristics of each log pattern over time.
[0075] Step 3.2: Calculate the dynamically weighted baseline frequency value for each log template based on the frequency matrix. For the m-th template in the log template set, its dynamic weighted baseline frequency value at the current baseline update time... dynamic baseline frequency value Calculate using the following formula: (2); Where N=1440, is the current baseline update time. The total number of historical statistical time slices previously used for baseline calculation, corresponding to a 24-hour backtracking window, is dimensionless; The frequency of the m-th log template in the i-th historical statistical time slice (in terms of logs per second) is taken from the element in the m-th row and i-th column of the frequency matrix obtained in step 3.1; The update time of the i-th historical statistical time slice relative to the current baseline The time decay weight (dimensionless) is calculated as follows: (3); in, This represents the center time (in seconds) of the i-th historical statistical time slice. This is the current baseline update time (in seconds). The time decay width parameter (in seconds) controls the decay rate of the influence of distant historical data on the current baseline. In this embodiment... The value is 3600 seconds, which is 1 hour.
[0076] because Its dimension is the square of a second. The dimension of is also the square of seconds, therefore the ratio within the exponent of formula (3) is a dimensionless quantity. It is a dimensionless scalar, with values ranging from 0 to +1.
[0077] In formula (2), the numerator is the sum of weighted frequencies, with a dimension of bars per second; the denominator is the sum of weights, which is dimensionless; therefore The dimension is bars per second, and The dimensions are consistent.
[0078] This weighted calculation method results in a larger contribution of historical statistical time slices closer to the current time to the baseline, while the contribution of historical statistical time slices farther from the current time gradually approaches zero according to the Gaussian decay curve. This gives the baseline the ability to track recent log pattern changes, while retaining sufficient historical smoothing effect to suppress short-term jitter.
[0079] For all within the backtracking window For templates with all zero values (i.e., those that have never appeared in the past 24 hours), formula (2) is not executed; instead, their baseline frequency values are directly set to 0 and marked as silent to avoid division by zero anomalies. For templates that appear newly in the backtracking window (i.e., those that did not exist in the previous baseline but are observed for the first time in the current window), all non-zero values in the current window are used. The arithmetic mean of the values is used as the initial baseline.
[0080] Step 3.3: Based on the dynamic baseline frequency values of each log template calculated in Step 3.2, set the periodic rolling update rules for the baseline.
[0081] The baseline rolling update is triggered at a fixed interval. In this embodiment, the interval is set to 60 seconds, which is consistent with the sliding window step size in step four. This ensures that each new sliding window position can use the latest updated baseline value, eliminating the asynchrony problem between the baseline update cycle and the window sliding step size.
[0082] Update the time every 60 seconds, using the current time as the baseline. Backtrack the historical data window of N=1440 statistical time slices, recalculate the baseline frequency value of all log templates according to formulas (2) and (3) in step 3.2, and replace the original baseline with the calculation result.
[0083] Furthermore, to address situations where planned changes in the operations and maintenance environment (such as version releases, configuration adjustments, etc.) cause a complete switch in log modes within a short period, this embodiment introduces change-aware judgment during baseline updates: If, within three consecutive update cycles, more than 30% of the log templates experience a baseline frequency change exceeding 50%, then the system is considered to be in a transition period, and the changes will be temporarily suspended. The timeout period has been shortened from 3600 seconds to 600 seconds, allowing the baseline to track the new pattern more quickly. After the transition period (i.e., when the baseline change rate falls below 10% for five consecutive update cycles), the timeout will be... Restored to 3600 seconds.
[0084] By rolling update rules and change awareness judgment, the baseline set can continuously track the normal evolution of log patterns in the operation and maintenance environment, while avoiding large-scale false alarms caused by planned changes.
[0085] Step 3.4: Generate a multi-granularity baseline set based on the rolling updated baseline frequency values. Multi-granularity refers to providing baseline references with varying degrees of coarseness across the temporal resolution dimension.
[0086] Specifically, this embodiment generates baselines at three granularities: The first particle size is the 60-second baseline, which is obtained directly from formula (2) in step 3.2. It is used to capture frequency fluctuations within short periods; The second granularity is the 15-minute baseline, which is obtained by taking the arithmetic mean of the baseline frequency values of 15 consecutive 60-second statistical time slices, and is used to reflect the medium-term trend. The third granularity is the 24-hour baseline, which is obtained by taking the arithmetic average of the 15-minute baselines over 24 consecutive hours, and is used to characterize the daytime steady-state level of the log pattern.
[0087] The three granular baselines are organized into a baseline table indexed by the log template number. This baseline table serves as the reference standard for the sliding window anomaly detection in step four.
[0088] Step 4: Based on the multi-granularity baseline set in Step 3, combined with temporal features and contextual correlation analysis, anomaly log events are identified in real time using a sliding window approach; This step uses the multi-granularity baseline set output in step three as a reference standard and the real-time log stream continuously output in step one as the observation object. Within a sliding window, it calculates the deviation between the actual observation frequency of each log template and the baseline, and performs secondary verification of deviation events using contextual correlation analysis. Finally, it outputs confirmed abnormal log events, specifically including: Step 4.1: Based on the multi-granularity baseline set output in Step 3 and the real-time log stream continuously output in Step 1, construct a sliding window observation sequence.
[0089] The sliding window length is set to 10 statistical time slices (i.e., 600 seconds), and the sliding step size is set to 1 statistical time slice (i.e., 60 seconds). Whenever a complete statistical time slice of log data is added to the log stream output channel in step one, the sliding window slides forward one time slice. The time slice data at the front of the window is included in the observation sequence, and the time slice data at the back of the window is removed from the observation sequence.
[0090] For each statistical time slice within the window, count the number of log records matched for each log template, divide this number by the time slice length of 60 seconds to obtain the actual observation frequency of each template within that time slice. ,in The time slice center time is 'm', where 'm' is the log template number. The unit is records per second. Thus, within the sliding window, a set of observation sequences is formed with time as the horizontal axis and the actual observation frequency of each log template as the vertical axis. This observation sequence will be progressively compared with the multi-granularity baseline set from step three.
[0091] Step 4.2: Based on the sliding window observation sequence constructed in Step 4.1 and the multi-granularity baseline set in Step 3, calculate the deviation score of each log template within the current window.
[0092] The deviation score for the m-th log template at the current statistical time t. Calculate according to the following formula: (4); in, The actual observation frequency (in terms of logs per second) of the m-th log template at the current statistical time t is taken from the observation sequence in step 4.1; The baseline frequency value (in bars per second) for the first granularity (60-second level) generated in step 3.4. This is the time of the most recent baseline update. Since step 3.3 has adjusted the baseline update interval to 60 seconds, which is consistent with the sliding window step size, therefore... It is always equal to the start time of the time slice in which the current time t is located; molecular The absolute value of the difference between the actual observed frequency and the baseline frequency is expressed in bars per second; W is the length of the sliding window, measured in terms of the number of statistical time slices. In this embodiment, W = 10 (dimensionless). The summation range is τ=t W+1 to τ=t 1. That is, only W-1=9 historical time slices before the current time are taken, excluding the current time t itself, in order to avoid the current observation value appearing in both the numerator and denominator, causing extreme outliers to self-dilution; This is the arithmetic mean (in seconds) of the actual observation frequency of the m-th log template in the history section of the window. ; in the denominator This is the sample variance of the historical observation frequency within the window, where dividing by W-2=8 is the correction for degrees of freedom (because...). Estimated from W-1=9 samples (with 9-1=8 degrees of freedom), the dimension is the square of bars per second. The extremely small positive constant introduced to prevent the denominator from being zero is not fixed in value, but is based on the historical frequency average within the backtracking window of the log template in step 3.2. Dynamically set to (Unit: squared bars per second), where The dimension is bars per second. The dimension of is the square of the bars per second, which is consistent with the dimension of the variance term.
[0093] When the historical frequency mean is large The corresponding increase prevents the high-frequency template, which is extremely stable, from generating excessively high deviation scores due to minor perturbations; When the historical frequency mean is small rollback to lower limit This ensures that the low-frequency template still has sufficient detection sensitivity.
[0094] The difference in the denominator plus Taking the square root gives the sample standard deviation, measured in bars per second. Therefore... As a dimensionless scalar, its physical meaning is the degree to which the actual observed frequency at the current moment deviates from the baseline, which is equivalent to how many times the historical normal fluctuation within the window. The larger the value, the more significant the deviation between the current observation frequency and the baseline is relative to historical normal fluctuations.
[0095] Step 4.3: Based on the deviation score calculated in Step 4.2, perform contextual verification on log templates whose deviation exceeds the preliminary threshold.
[0096] The initial threshold is set to 3 in this embodiment, that is, when At that time, the observation frequency of the log template is considered to have a suspicious deviation and requires further verification.
[0097] The specific steps for context-related validation are as follows: In the cluster hierarchy tree output in step two, retrieve the parent cluster of the cluster to which the current suspicious log template belongs, as well as all sibling clusters under that parent cluster except the current cluster (i.e., other clusters that share the same parent cluster as the current cluster). Check whether the actual observation frequency of the log templates corresponding to these sibling clusters also shows significant changes in the same or opposite directions within the same time slice. If at least one template in the templates corresponding to the sibling cluster has a deviation score greater than 2, then the current suspicious deviation is considered to have contextual relevance and is confirmed. If the deviation score of the template corresponding to all sibling clusters is less than 2, then the current suspected deviation is considered to be an isolated statistical jitter and is marked as an observation state.
[0098] For deviation events that are in the observation state, their deviation scores are recalculated for each subsequent sliding window step: If the deviation score falls below 3 within two consecutive window steps, the suspicious flag will be removed and it will not be output as an abnormal event. If the deviation score is still greater than or equal to 3 within two consecutive window steps, it will be upgraded to a confirmed anomaly and included in the list of anomalies. If the score drops below 3 after the first window step but exceeds 3 again after the second window step, the observation counter is reset and the judgment for two consecutive window steps is restarted.
[0099] After contextual verification, only deviation events with contextual relevance and events that are upgraded to confirmed anomalies after observation are retained, while isolated statistical fluctuations are filtered out, thereby reducing false alarms.
[0100] Step 4.4: Based on the deviation events verified through context association in Step 4.3, output the abnormal log event judgment results.
[0101] For each verified deviation event, it is packaged into an exception log event record containing the following fields: The time of the anomaly (taken from the current statistical time t), the log template number involved, and the deviation score. The numerical value, the direction of deviation (frequency increase or frequency decrease), the list of associated template numbers (i.e., the sibling cluster template numbers involved in the verification in step 4.3), the comparison value between the observed frequency and the baseline frequency within the sliding window, and the preliminary judgment of the severity level of the anomaly event.
[0102] The initial severity level is determined based on the numerical range of the deviation score: An anomaly score between 3 and 5 is considered mild, between 5 and 8 is considered moderate, and above 8 is considered severe. All anomaly log events are recorded in chronological order of occurrence to form an anomaly event list.
[0103] Step 5: Based on the list of abnormal events output in Step 4, push the detection results to the alarm platform; This step takes the list of abnormal events output in step four as input, classifies each abnormal log event into alarm levels, assembles structured alarm information, and then pushes the alarm information to the alarm platform through multiple channels. A complete record is then created for each alarm event on the alarm platform. Specifically, this includes: Step 5.1: Based on the initial severity level assessment of each abnormal log event record in the abnormal event list output in Step 4, perform the final classification of alarm levels.
[0104] The initial severity level assessment is a preliminary judgment made in step four based solely on the deviation score range. This step adds two additional dimensions to this assessment for a comprehensive evaluation.
[0105] The first additional dimension is the importance of the source component corresponding to the log template involved in the anomaly: the importance of the source component is determined based on the service level marker in the operation and maintenance topology. The service level marker is pre-configured by the operation and maintenance personnel when the operation and maintenance topology is built, and is divided into two categories: core business services and auxiliary support services. Core business services refer to the main link service components that carry external business requests, while auxiliary support services refer to non-main link components that provide auxiliary capabilities such as logging, monitoring, and caching to the main link. If the source component is a core business service, the alarm level is increased by 1 level; if the source component is an auxiliary support service, the initial judgment level remains unchanged.
[0106] The second additional dimension is the duration of the abnormal event over time: if a deviation event of the same log template persists for more than three consecutive sliding window steps, the alarm level is increased by one level. After comprehensive evaluation of the two additional dimensions, each abnormal log event obtains a final alarm level, which is divided into four levels: alert, warning, severe, and urgent.
[0107] Step 5.2: Based on the determined final alarm level, generate structured alarm information for each abnormal log event.
[0108] Structured alarm information includes the following fields: unique alarm event identifier (generated in a globally ascending sequence), alarm occurrence time, final alarm level, log template number involved and its corresponding log template text, deviation score value, deviation direction, list of associated template numbers, source component name, and log context fragments before and after the anomaly (the message body of 5 log records before and after the anomaly occurrence time).
[0109] These fields are assembled according to the unified data structure specified by the alarm platform to form a complete alarm message body. For abnormal events with a final alarm level of "urgent", an additional priority processing flag field is added to the alarm message body.
[0110] Step 5.3: Based on the structured alarm message body assembled in Step 5.2, perform multi-channel push. The push channels include three types: the application interface channel of the alarm platform, the instant messaging channel, and the SMS channel.
[0111] For abnormal events with a final alarm level of prompt or warning, the alarm will be pushed only through the application interface channel of the alarm platform and displayed on the console interface by the alarm platform. For abnormal events with a final alarm level of "severe", notifications are sent to the on-duty operations and maintenance personnel's instant messaging clients at the same time as being displayed on the console. For anomalies with a final alarm level of "urgent," alerts are pushed simultaneously through application interface channels, instant messaging channels, and SMS channels to ensure that on-duty maintenance personnel receive alarm notifications promptly regardless of their work status. Each alarm message includes a push receipt request, and the alarm platform and each channel return an acknowledgment receipt upon successful receipt.
[0112] Step 5.4: Based on the confirmation receipts from each push channel, create a complete alarm event file for each abnormal log event in the alarm platform.
[0113] The alarm event archive uses the unique identifier number of the alarm event as the main index and records complete information about the entire process from the generation of the abnormal event to the push, including: the original abnormal log event record output in step 4, the alarm level assessment process and basis in step 5.1, the full text of the structured alarm message body in step 5.2, and the push time and confirmation receipt time of each push channel in step 5.3.
[0114] If an alarm message does not receive a confirmation receipt within 30 seconds after being pushed, a resend operation will be automatically triggered. The maximum number of resends is 3. After 3 resends, the message will be marked as a push failure in the file and the reason for the failure will be recorded.
[0115] Once the alarm event file is established, the final alarm level and abnormal event details recorded in the file will serve as the trigger input for the automated handling process in step six. Files with a final alarm level of critical or urgent will automatically trigger the handling process in step six immediately after establishment, without waiting for manual confirmation. Files with a final alarm level of alert or warning will only be kept as records and will not trigger step six.
[0116] Step Six: Based on the alarm event file established in Step Five, trigger the automated handling process; This step uses the alarm event file established in step five as the triggering basis. It matches the corresponding handling plan based on the type and scope of the abnormal event, generates handling instructions, and issues them to the target maintenance object for automated operation. Finally, it records and archives the handling execution results, specifically including: Step 6.1: Based on the alarm event file established in Step 5, analyze the anomaly type and impact scope corresponding to each alarm event. The anomaly type is determined based on the deviation direction recorded in the alarm event file and the relevant log template number: If the deviation is a decrease in frequency and involves heartbeat or health check logs corresponding to the log template, the exception type is determined to be service unreachable. If the deviation direction is an increase in frequency and involves error logs or exception stack logs corresponding to the log templates involved, then the exception type is determined to be a surge in service errors; If the deviation is due to an increase in frequency and involves resource alert logs corresponding to the log template, the anomaly type is determined to be a resource exhaustion warning; other cases are classified as general anomalies.
[0117] The scope of impact is determined based on the source component name and its upstream and downstream relationships in the operations and maintenance topology, as recorded in the alarm event file. During system deployment, the operations and maintenance topology is manually entered by operations personnel based on the service dependencies of the actual environment and stored in the topology configuration library. Each node in the topology represents a service component, and each directed edge represents a call dependency relationship, with the direction of the edge indicating the caller's direction to the callee. Starting from the source component, the scope is expanded two hops upstream and downstream along the directed edges of the operations and maintenance topology, including all expanded components in the scope of impact list.
[0118] Step 6.2: Based on the anomaly type and impact range obtained in Step 6.1, retrieve and match the corresponding emergency response plan from the emergency response plan database.
[0119] The contingency plan database pre-stores contingency plan entries categorized by anomaly type. Each contingency plan includes a plan number, applicable anomaly type, applicable impact range conditions, sequence of actions, execution order, rollback conditions, and rollback actions.
[0120] The matching process is as follows: First, using the anomaly type determined in step 6.1 as the filtering condition, all contingency plan entries applicable to this anomaly type are filtered from the contingency plan library. Then, the filtering results are further filtered using the number and type of components in the impact scope list as conditions, selecting the contingency plan entry that best matches the impact scope condition with the current alarm event. If multiple contingency plan entries have the same degree of matching, the one with the smallest contingency plan number (i.e., the highest priority) is selected. If there is no contingency plan entry in the contingency plan library that matches the current anomaly type, a manual intervention request is generated and pushed to the instant messaging channel of the operations and maintenance personnel, awaiting manual handling.
[0121] Step 6.3: Based on the contingency plan matched in Step 6.2, generate contingency instructions and issue them to the target maintenance object. The sequence of contingency actions in the contingency plan is converted into executable contingency instructions one by one according to the execution order.
[0122] Each handling instruction includes the identifier of the target maintenance object, the operation type (such as restarting the service process, increasing the resource quota, switching traffic to the backup node, isolating the faulty instance, etc.), the operation parameters (such as the timeout waiting time for restart, the target value of the resource quota, the target node address for traffic switching, etc.), and the rollback conditions for this instruction.
[0123] The method of issuing handling instructions is distinguished based on the final alarm level recorded in step five: For abnormal events with an emergency alarm level, if there is no dependency between multiple handling instructions in the handling plan (i.e., the execution of the next instruction does not depend on the return result of the previous instruction), these undependent instructions will be issued in parallel to shorten the total handling time; if there is a dependency between the instructions, they will still be issued sequentially, and the next instruction will be issued only after the previous handling instruction has been executed and returned a success confirmation.
[0124] For anomalies with a final alarm level of "severe," all handling instructions are issued sequentially. If a handling instruction fails after execution, and the reason for failure meets the rollback conditions for that instruction, the corresponding rollback action in the contingency plan is executed, the issuance of subsequent instructions is terminated, and a handling failure notification is generated and pushed to the maintenance personnel on duty.
[0125] Step 6.4: Based on the execution results of the disposal instructions in Step 6.3, generate a disposal report and archive all disposal records. The disposal report includes: The alarm event that triggered this action must include its unique identifier, anomaly type, list of affected areas, matching action plan number, issuance time of each action instruction, execution result, execution time, and final action conclusion (action successful, partial success, or action failed).
[0126] The handling report is written into the operation and maintenance event log database in a structured format and linked with the alarm event file established in step five through a unique alarm event identifier number, forming a complete event chain record from anomaly detection, alarm push to automated handling. This chain record can be reviewed by operation and maintenance personnel afterward to analyze the root cause of the anomaly and the handling effect, and also provides factual basis for subsequently improving the contingency plan entries in the contingency plan database.
[0127] The above description is merely an exemplary embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention specification and drawings under the technical concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.
Claims
1. A method for real-time detection of anomalies in operation and maintenance logs, characterized in that, include: The distributed acquisition agent acquires multi-source heterogeneous operation and maintenance log streams in real time, performs format regularization and global time sequence arrangement on the multi-source heterogeneous operation and maintenance log streams, and outputs the log stream sequence. The logs in the log stream sequence are semantically vectorized and encoded using a pre-trained semantic coding network. The semantic similarity between log entries is calculated based on the encoding results, and incremental hierarchical clustering is performed to extract the log template set. The frequency distribution of each log template in the log template set is statistically analyzed, and the dynamically weighted baseline frequency value is calculated to generate a multi-granularity baseline set; The deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set is calculated using a sliding window method. Contextual verification is performed in conjunction with a cluster hierarchical tree, and a list of abnormal events is output. The list of abnormal events is classified into alarm levels and the detection results are pushed to the alarm platform to establish an alarm event file; The alarm event file is matched with the handling plan and the handling instructions are issued to execute automated handling.
2. The method for real-time detection of anomalies in operation and maintenance logs according to claim 1, characterized in that, The real-time acquisition of multi-source heterogeneous operation and maintenance log streams through a distributed acquisition agent includes: Deploy a collection agent process on each log-generating node in the operation and maintenance environment. The collection agent process continuously pulls new log data from the end of the log file in an append-only manner according to the path and frequency specified in the collection configuration file, and adds a local timestamp and a local monotonically increasing counter value to each log. The logs obtained by the data collection agent process are formatted and converted from plain text, structured key-value pair, and semi-structured markup language formats into a unified record format that includes time, severity, source component, message body, and extended fields. The log records with complete and standardized format are globally rearranged in time. They are initially sorted based on local timestamps. When the difference between the local timestamps of two log records is less than the clock skew tolerance threshold, they are sorted a second time based on the local monotonically increasing counter value, forming a log stream sequence arranged in ascending time. Log records that have completed global timing orchestration are allocated to high-priority buffer queues, medium-priority buffer queues, and low-priority buffer queues according to their severity level. The scheduler then retrieves log records from the three buffer queues in sequence according to a fixed rotation ratio and writes them to the log stream output channel.
3. The method for real-time detection of anomalies in operation and maintenance logs according to claim 1, characterized in that, The step of using a pre-trained semantic coding network to perform semantic vectorization encoding on the logs in the log stream sequence includes: Each log message body is segmented to obtain a word sequence. Start and end markers are added to the beginning and end of the word sequence, respectively. The processed word sequence is input into a pre-trained semantic coding network, and the hidden layer output at the position corresponding to the end marker is taken as the semantic vector representation of the message body. For log records whose message body length exceeds the maximum input length of the network, a concatenation method is adopted, which retains half the length of words at the beginning and end and fills the middle with ellipsis markers; Perform an inner product operation on the semantic vectors of any two logs in the log stream, and divide by the product of the Euclidean norms of the two semantic vectors to obtain the semantic similarity with a value between negative one and positive one. The locality-sensitive hashing method is used to pre-filter semantic vectors by binning. Semantic similarity is calculated only for log pairs that fall into the same or adjacent bins, reducing the computational cost from the quadratic order of the total number of logs to approximately linear.
4. The method for real-time detection of anomalies in operation and maintenance logs according to claim 3, characterized in that, The incremental hierarchical clustering operation includes an initial setup phase and an incremental update phase. In the initial setup phase, each log record forms a separate cluster. In each iteration, the two clusters with the highest semantic similarity are selected for merging. The similarity between the two clusters is measured by the average semantic similarity of all log pairs in the two clusters. The merging operation continues until the average semantic similarity between any two existing clusters is lower than the clustering termination threshold. During the merging process, the merging relationship of each layer is recorded to form a bottom-up cluster hierarchy tree. Each internal node in the cluster hierarchy tree is the parent cluster of its two child nodes. During the incremental update phase, whenever a new log record is added to the log stream, the similarity between the semantic vector of the new log record and the center vector of all existing clusters is calculated. If the maximum similarity is greater than or equal to the clustering termination threshold, the new log record is merged into the corresponding cluster and the cluster hierarchy tree is updated. If the maximum similarity is lower than the clustering termination threshold, a new cluster is created for the new log record and attached to the top layer of the cluster hierarchy tree as an independent leaf node. Every preset period, the agglomeration process is re-executed for all existing clusters to generate a new cluster hierarchy tree. New log records arriving during the execution are recalculated and temporarily stored in the incremental buffer. After the new cluster hierarchy tree is generated, the incremental incorporation is performed uniformly.
5. The method for real-time detection of anomalies in operation and maintenance logs according to claim 1, characterized in that, The statistical analysis of the frequency distribution of each log template in the log template set, and the calculation of the dynamically weighted baseline frequency value, includes: Divide the timeline into equal-length statistical time slices, count the number of log records matched by each log template in each statistical time slice, divide by the duration of the statistical time slice to obtain the frequency of occurrence, and form a frequency matrix with log templates as rows and statistical time slices as columns. For logs whose semantic vectors have a similarity to the center vectors of all the clusters to which the templates belong that is lower than the clustering termination threshold, they are marked as unmatched logs and temporarily stored in the unmatched buffer, waiting for the incremental update phase to create new clusters and new templates. For each log template in the frequency matrix, a preset number of historical statistical time slices are traced back from the current baseline update time. The occurrence frequency of each historical statistical time slice is multiplied by the corresponding time decay weight, summed, and then divided by the sum of the time decay weights to obtain the dynamic weighted baseline frequency value. The time decay weight is calculated by taking the negative exponent of the square of the difference between the current baseline update time and the center time of the historical statistical time slice, so that historical data closer to the current time contributes more to the baseline, while the contribution of historical data farther away approaches zero according to the decay curve; for log templates that appear with a frequency of zero in the backtracking window, the dynamic weighted baseline frequency value is set to zero and marked as silent. The baseline is triggered to roll over at a fixed interval consistent with the sliding window step size. During each update, the dynamic weighted baseline frequency value of all log templates is recalculated and the original baseline is replaced to ensure that each new sliding window position uses the latest updated baseline value.
6. The method for real-time detection of anomalies in operation and maintenance logs according to claim 5, characterized in that, The statistical analysis of the frequency distribution of each log template in the log template set and the calculation of the dynamically weighted baseline frequency value also include change awareness judgment, specifically including: If the baseline frequency value of a log template that exceeds a preset proportion changes by more than a preset threshold within multiple consecutive update cycles, it is determined that the current period is in a change transition period. The time decay width parameter in the time decay weight is temporarily shortened to enable the baseline to track the changed log pattern faster. Once the baseline change amplitude falls back to the preset range within multiple consecutive update cycles, the time decay width parameter is restored to its original value. The generated multi-granularity baseline set includes: the first granularity is the dynamically weighted baseline frequency value at the level of a single statistical time slice, used to capture frequency fluctuations within a short period; the second granularity is the arithmetic mean of the dynamically weighted baseline frequency values of multiple consecutive statistical time slices, used to reflect the medium-term trend; the third granularity is the arithmetic mean of the second granularity baselines over multiple consecutive hours, used to characterize the daytime steady-state level of the log pattern; the baselines of the three granularities are organized into a baseline table indexed by the log template number.
7. The method for real-time detection of anomalies in operation and maintenance logs according to claim 1, characterized in that, The method of calculating the deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set using a sliding window approach, combined with contextual verification using a cluster hierarchy tree, includes: Construct a sliding window observation sequence. The length of the sliding window is set according to the number of statistical time slices, and the sliding step is set to one statistical time slice. Whenever a complete statistical time slice of log data is added to the log stream output channel, the sliding window slides forward one time slice. For each statistical time slice in the window, the number of log records matched by each log template is counted and divided by the time slice length to obtain the actual observation frequency. For each log template, a deviation score is calculated. The deviation score is the absolute value of the difference between the actual observation frequency at the current moment and the frequency value of the first granularity baseline in the multi-granularity baseline set, divided by the sample standard deviation of the historical observation frequencies within the window, where the update time of the first granularity baseline frequency value is aligned with the current time of the sliding window. The summation range only includes historical time slices prior to the current moment and does not include the current moment itself, in order to avoid the current observation appearing in both the numerator and denominator, which would cause extreme outliers to self-dilution. The calculation of the sample standard deviation introduces a minimum positive constant dynamically set based on the historical frequency mean of the log template to prevent the denominator from being zero. When the historical frequency mean is large, the minimum positive constant increases accordingly, and when the historical frequency mean is small, the minimum positive constant returns to the lower limit. For log templates whose deviation scores exceed the initial threshold, contextual verification is performed. The parent cluster of the cluster to which the suspicious log template belongs and all sibling clusters under the parent cluster except the current cluster are retrieved in the cluster hierarchy tree. The log templates corresponding to the sibling clusters are checked to see if there are significant changes in the same or opposite directions within the same time slice. If at least one template in the sibling cluster has a deviation score that exceeds the association threshold, the deviation event is confirmed. If the deviation scores of all templates in the sibling cluster do not exceed the association threshold, the event is marked as pending observation. Deviation events in the pending observation state have their deviation scores recalculated in subsequent sliding window steps. If the deviation score falls below the initial threshold within multiple consecutive window steps, the suspicious flag is removed. If the deviation score still exceeds the initial threshold within multiple consecutive window steps, the event is upgraded to confirmed anomaly.
8. The method for real-time detection of anomalies in operation and maintenance logs according to claim 1, characterized in that, The process of classifying alarm levels and pushing detection results to the alarm platform includes: The final alarm level is determined by adding two additional dimensions based on the initial severity level assessment: The first additional dimension is the importance of the source component. The importance of the source component is determined based on the service level marker in the operation and maintenance topology. The alarm level corresponding to the core business service is upgraded by one level, while the initial judgment level of the auxiliary support service remains unchanged. The second additional dimension is the duration of the abnormal event over time. If a deviation event of the same log template persists within multiple consecutive sliding window steps, the alarm level will be increased by one level; the alarm level increase is capped at the urgency level. For each abnormal log event, generate structured alarm information. The structured alarm information includes the unique identifier number of the alarm event, the time of alarm occurrence, the final alarm level, the deviation score value, the deviation direction, the list of associated template numbers, the name of the source component, and the log context fragments before and after the abnormality occurred. Based on the final alarm level, a multi-channel push is executed, including the application interface channel of the alarm platform, the instant messaging channel, and the SMS channel. Each alarm message body is pushed with a push receipt request. If no confirmation receipt is received after the receipt waiting time, a resend operation is automatically triggered. An alarm event file is created for each abnormal log event in the alarm platform. Alarm event files with a final alarm level of severe or urgent will automatically trigger an automated handling process after creation. Alarm event files with a final alarm level of prompt or warning will only be retained as records.
9. The method for real-time detection of anomalies in operation and maintenance logs according to claim 1, characterized in that, The matching and handling plan and the issuance of handling instructions for automated handling include: Based on the analysis of alarm event files, the anomaly type and impact scope are determined. The anomaly type is determined according to the deviation direction and the log template involved, and is divided into service unreachable, service error surge, resource exhaustion warning and general anomaly. The impact scope is extended to the upstream and downstream of the operation and maintenance topology by a preset number of hops from the source component, and all components extended to are included in the impact scope list. The system filters applicable emergency response plans from the emergency response plan library based on the anomaly type, and then performs a second filtering based on the number and type of components in the impact scope list to select the emergency response plan with the highest degree of matching. If no matching emergency response plan is found in the emergency response plan library, a manual intervention request is generated and pushed to the instant messaging channel of the operation and maintenance personnel on duty. The sequence of actions in the emergency response plan is converted into action instructions one by one according to the execution order and sent to the target maintenance object. Each action instruction includes the identifier of the target maintenance object, the operation type, the operation parameters, and the rollback conditions. For abnormal events with an emergency alarm level, handling instructions that do not have a sequential dependency are issued in parallel to shorten the total handling time, while handling instructions that have a sequential dependency are issued sequentially. If a handling instruction fails after execution and meets the rollback conditions, the corresponding rollback action is executed and the issuance of subsequent instructions is terminated. Based on the execution results of the handling instructions, a handling report is generated and written to the operation and maintenance event log database. The handling report includes the unique identifier number of the alarm event that triggered the handling, the anomaly type, the list of affected areas, the matching handling plan number, the issuance time and execution result of each handling instruction. The handling report and the alarm event file are linked through the unique identifier number of the alarm event to form a complete event chain record.
10. A real-time anomaly detection system for operation and maintenance logs, characterized in that, The method for real-time detection of anomalies in operation and maintenance logs as described in any one of claims 1-9 includes: The log collection module is used to acquire multi-source heterogeneous operation and maintenance log streams in real time through a distributed collection agent, perform format regularization and global time sequence arrangement on the multi-source heterogeneous operation and maintenance log streams, and output the log stream sequence. The semantic parsing and template clustering module is used to perform semantic vectorization encoding on the logs in the log stream sequence using a pre-trained semantic coding network, calculate the semantic similarity between log entries based on the encoding results, perform incremental hierarchical clustering operations, and extract the log template set. The dynamic baseline generation module is used to statistically analyze the frequency distribution of each log template in the log template set and calculate the dynamic weighted baseline frequency value to generate a multi-granularity baseline set. The sliding window anomaly detection module is used to calculate the deviation score between the actual observation frequency of each log template and the dynamically weighted baseline frequency value in the multi-granularity baseline set using a sliding window method, perform context association verification in combination with the cluster hierarchy tree, and output a list of anomalies. The alarm push module is used to classify the list of abnormal events into alarm levels and push the detection results to the alarm platform to establish an alarm event file; The automated handling module is used to match the handling plan with the alarm event file and issue handling instructions to execute automated handling.
