LogAnomaly: Unsupervised Detection of Sequential and Quantitative Anomalies in Unstructured Logs

Weibin Meng, Ying Liu, Yichen Zhu, Shenglin Zhang, Dan Pei, Yuqing Liu, Yihao Chen, Ruizhi Zhang, Shimin Tao, Pei Sun, Rong Zhou

Abstract

LogAnomaly is an unsupervised framework that treats system log streams as natural language sequences to detect failures. By leveraging a novel "template2vec" embedding that captures the semantic meaning of log messages, it simultaneously identifies sequence-breaking and count-based anomalies. This approach allows the system to handle new, unseen log types without manual intervention, significantly improving robustness over traditional index-based methods.

Introduction

Modern large-scale services generate massive volumes of unstructured logs that record system health. Manually monitoring these is impossible, and existing automated tools suffer from three major flaws:

  1. Semantic Blindness: Most tools treat log templates as arbitrary numerical indexes, ignoring the actual words. This prevents them from recognizing that "Link down" and "Interface down" are semantically similar.
  2. The "New Template" Gap: Systems evolve. When software updates introduce new log messages, traditional detectors often flag them as anomalies simply because the specific ID is unknown.
  3. Incomplete Modeling: Anomalies are typically sequential (wrong order) or quantitative (wrong frequency). Most state-of-the-art tools focus on only one type.

Methodology

LogAnomaly introduces a unified pipeline to address these challenges. The framework consists of log parsing, semantic embedding, and a dual-path detection model.

Figure 1: Overview of the LogAnomaly framework, illustrating the offline learning and online detection phases.

Log Parsing and Template2Vec

The system uses FT-Tree to extract templates from raw logs. The core innovation is Template2Vec, which converts templates into high-dimensional vectors using a distributional lexical-contrast embedding (dLCE) model. By incorporating synonyms and antonyms (via WordNet and domain knowledge), it ensures that "Up" and "Down" are far apart in vector space, while "Link" and "Interface" remain close.

Dual LSTM Detection

These vectors are fed into two Long Short-Term Memory (LSTM) networks:

  • Sequential Path: Learns the order of events to predict the next likely log vector.
  • Quantitative Path: Monitors the counts of different log types within a sliding window to detect frequency-based anomalies.

For brand-new logs encountered during production, LogAnomaly calculates a vector and matches it to the most similar existing template, preventing false alarms from minor log variations.

Evaluation

The authors evaluated LogAnomaly on two production datasets: HDFS (11.1 million logs) and BGL (4.7 million logs), both manually labeled by experts.

Key Results

LogAnomaly significantly outperformed baselines like DeepLog, PCA, and Invariant Mining across precision, recall, and F1 metrics.

Figure 2: Performance comparison of LogAnomaly against various baseline methods and ablation studies.
  • High Accuracy: It achieved an F1 score of 0.96 on BGL and 0.95 on HDFS, outperforming all unsupervised baselines.
  • False Alarm Reduction: On the BGL dataset, LogAnomaly reduced false alarms by a factor of 3 to 5 compared to DeepLog and Invariant Mining.
  • Real-world Robustness: In a case study involving a cloud service provider's switch logs, LogAnomaly successfully detected a link flapping event while other tools either missed it or generated multiple false positives.

Conclusion and Future Work

LogAnomaly demonstrates that logs are a specialized language. By applying NLP techniques like word embeddings, anomaly detection becomes more tolerant of natural variations in system reporting. While the system currently requires some domain-specific input for synonyms/antonyms and periodic retraining for long-term evolution, its ability to handle semantic similarity marks a significant step forward in automated system monitoring.

Summary updated

BibTeX
@inproceedings{meng2019loganomaly,
  author = {Weibin Meng and Ying Liu and Yichen Zhu and Shenglin Zhang and Dan Pei and Yuqing Liu and Yihao Chen and Ruizhi Zhang and Shimin Tao and Pei Sun and Rong Zhou},
  title = {{LogAnomaly: Unsupervised Detection of Sequential and Quantitative Anomalies in Unstructured Logs}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.24963/ijcai.2019/658},
}
Figure