AutoLog: A Log Sequence Synthesis Framework for Anomaly Detection

Yintong Huo, Yichen Li, Yuxin Su, Pinjia He, Zifan Xie, Michael R. Lyu

Abstract

Log-based anomaly detection is a cornerstone of modern Site Reliability Engineering (SRE), yet its progress is frequently hindered by the scarcity of high-quality, labeled datasets. Traditional "passive" collection methods—running a system and recording its output—fail to capture the full breadth of potential system behaviors and are labor-intensive to scale. This paper presents AutoLog, a novel framework that shifts the paradigm from passive collection to active synthesis. By utilizing static program analysis to navigate the source code of a target system, AutoLog generates comprehensive log sequences that represent a wide array of execution paths, including rare failure modes. Our evaluation demonstrates that AutoLog achieves significantly higher code coverage and improves the performance of downstream anomaly detection models compared to traditional datasets.

1. Introduction

In distributed systems, logs serve as the primary diagnostic record for identifying and resolving failures. However, training machine learning models for anomaly detection requires large, diverse, and accurately labeled datasets. Currently, the research community relies on a handful of "gold standard" datasets (e.g., HDFS, BGL) collected by running systems under specific workloads and injecting faults.

This passive approach has reached a plateau. It is inherently limited by the test cases used during collection, often missing "edge case" logging statements hidden in the source code. Furthermore, the operational overhead of configuring and running complex systems like Hadoop or Zookeeper makes it difficult to generate new data at scale. AutoLog addresses these challenges by treating log generation as a path-finding problem within the software’s static call graph, allowing for the rapid synthesis of diverse log sequences without ever executing the code.

2. The Limitations of Passive Log Collection

Passive collection methods suffer from three primary deficiencies:

  1. Low Coverage: Many logging statements are only triggered under specific, rare conditions. Passive workloads rarely reach these branches, leading to datasets that represent only a fraction of the system's logging potential.
  2. Poor Scalability: Setting up large-scale distributed environments for data collection is time-consuming and resource-heavy.
  3. Inflexibility: Once a dataset is collected, its parameters (such as the ratio of anomalous to normal sequences) are fixed. Researchers cannot easily adjust the data to focus on specific components or failure types.

3. The AutoLog Framework

AutoLog overcomes these hurdles through a three-phase synthesis pipeline designed to extract realistic log sequences directly from source code.

3.1 Phase I: Logging Statement Probing

The framework begins by performing static analysis on the application's source code to construct a comprehensive call graph. It identifies all "LogMethods"—methods that contain logging invocations (e.g., LOG.info or logger.error). This provides a map of every possible point where the system can emit information.

To manage the "path explosion" problem inherent in large software projects, AutoLog prunes the call graph by removing any nodes that do not eventually lead to a logging statement. In the case of HDFS, this pruning reduced the graph complexity by over 85%. The framework then performs intra-method analysis to identify specific execution paths (LogEPs) and resolves constant string parameters to ensure the synthesized logs mirror the format of real-world output.

3.3 Phase III: Log Path Walking and Synthesis

The final phase involves generating the actual log sequences:

  • Seed Annotation: A small number of "alerting" log statements are manually labeled by experts (e.g., "Connection refused").
  • Label Propagation: AutoLog automatically propagates these labels through the graph. If a path leads to a method containing a known anomaly, that path is marked as potentially anomalous.
  • Random Walks: The framework performs random walks across the pruned graph to generate sequences. Users can tune the walk parameters to control the dataset size, anomaly rate, and the specific system components being simulated.

4. Experimental Evaluation

We evaluated AutoLog against four major passive datasets ($\mathcal{D}$-HDFS, $\mathcal{D}$-Hadoop, $\mathcal{D}$-BGL, and $\mathcal{D}$-Zookeeper) and applied it to 50 popular Java projects from the Maven repository, including Apache Kafka, Flink, and Storm.

4.1 Comprehensiveness and Efficiency

AutoLog demonstrated a significant advantage in coverage, capturing an average of 87.38% of all possible logging statements across the studied projects. For comparison, the existing Hadoop dataset only covered 7.1% of the system's potential log events. Furthermore, AutoLog generated between 9x and 58x more unique log events than passive methods and did so 15x faster than the time required for traditional system execution and collection.

4.2 Impact on Anomaly Detection

To test the utility of synthetic data, we trained state-of-the-art anomaly detectors (CNNs and Transformers) on AutoLog-generated data and tested them on real-world logs. The models trained on AutoLog data showed a 1.93% average improvement in F1-score, indicating that the synthetic sequences are highly representative of real-world system behavior.

5. Discussion and Limitations

While AutoLog represents a significant step forward, certain challenges remain. Static analysis has inherent difficulty predicting runtime exceptions (e.g., NullPointerException) that are not explicitly caught and logged. Additionally, the current framework focuses on single-thread execution paths, whereas real-world logs often feature interleaved sequences from multiple concurrent threads. Future iterations of AutoLog will aim to incorporate multi-threading logic and more sophisticated synthesis of dynamic parameters like IP addresses and session IDs.

6. Conclusion

AutoLog demonstrates that source code is an underutilized resource for log-based anomaly detection. By shifting from passive collection to active synthesis via static analysis, researchers can generate massive, diverse, and labeled datasets that were previously unattainable. This framework provides a scalable foundation for developing more robust and generalizable SRE tools.

Summary updated

BibTeX
@inproceedings{huo2023autolog,
  author = {Yintong Huo and Yichen Li and Yuxin Su and Pinjia He and Zifan Xie and Michael R. Lyu},
  title = {{AutoLog: A Log Sequence Synthesis Framework for Anomaly Detection}},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00133},
}
Figure