GLAD: Content-Aware Dynamic Graphs For Log Anomaly Detection

Yufei Li, Yanchi Liu, Haoyu Wang, Zhengzhang Chen, Wei Cheng, Yuncong Chen, Wenchao Yu, Haifeng Chen, Cong Liu

Introduction

In modern large-scale systems, log anomaly detection is a critical component for maintaining reliability and security. Traditional approaches have largely focused on sequential patterns—identifying when the order of system events deviates from a learned baseline. While effective for simple failures, these methods often overlook the rich relational data embedded within log messages, such as interactions between specific User IDs, IP addresses, or file paths.

GLAD (Graph-based Log Anomaly Detection) is a novel framework designed to address this gap. By modeling system logs as dynamic, evolving graphs, GLAD identifies "relational anomalies"—unusual interactions between system components that appear sequentially normal but are structurally suspicious. This approach combines few-shot entity extraction, Graph Neural Networks (GNNs), and Transformers to capture the semantic, structural, and temporal dimensions of system behavior.

The GLAD Framework

The GLAD architecture operates through a three-stage pipeline designed to transform raw log data into actionable insights.

1. Prompt-Based Field Extraction

Traditional log parsers often rely on rigid regular expressions that struggle with the diversity of log formats. GLAD utilizes a few-shot learning approach with a BART model to extract 15 common log fields (e.g., PID, IP, File Path). By providing the model with only a handful of examples, it can generalize to new log formats without extensive manual labeling, making the system highly adaptable to evolving environments.

2. Dynamic Graph Construction

For every sliding time window, GLAD constructs a heterogeneous graph. In this model:

  • Nodes represent log event templates and the specific extracted fields.
  • Edges are established whenever a field appears within an event.
  • Semantic Embeddings are generated using Sentence-BERT to capture the textual meaning of each node, ensuring the model understands the context of the log message rather than treating it as an opaque identifier.

3. Temporal-Attentive Detection

To detect anomalies, GLAD employs a dual-encoder strategy:

  • GCN Encoder: A Graph Convolutional Network captures the structural relationships within a single time window, identifying if the current "snapshot" of the system shows unusual connectivity.
  • Transformer Encoder: A Transformer processes a sequence of these graph snapshots to understand the system's evolution over time.
  • Multi-granularity Learning: The model is trained using a dual-loss objective that monitors both edge-level anomalies (specific weird interactions) and graph-level anomalies (entirely suspicious time windows) using a soft-margin hypersphere approach.

Experimental Evaluation

The authors evaluated GLAD against three distinct datasets to test its versatility and robustness:

  • BGL (BlueGene/L): A large-scale supercomputer dataset.
  • AIT (Austrian Institute of Technology): Web server logs featuring simulated user behaviors.
  • Sock Shop: A microservices-based e-commerce testbed specifically used to inject relational anomalies, such as a single user browsing an abnormally high number of items.

Key Results

GLAD consistently outperformed state-of-the-art baselines, including DeepLog, LogBERT, and AddGraph. On the BGL dataset, GLAD achieved a leading F1-score of 92.66% and an AUC of 98.18%.

Crucially, in the Sock Shop dataset—designed to challenge sequence-only models—GLAD achieved an F1-score of 69.35%, whereas traditional methods like PCA or OCSVM failed to reach 30%. Despite its sophisticated graph-based approach, GLAD maintains a testing overhead of approximately 92ms per log, ensuring it remains viable for real-time system monitoring.

Discussion and Insights

The success of GLAD highlights several key insights for the future of log analysis:

  • Relational Context is Essential: Anomaly detection is not just about what happened, but who initiated the action and which resource was affected. Treating entities as graph nodes allows the model to track behavior across the entire network.
  • Practicality through Few-Shot Learning: The ability to adapt to new systems with only 10 labeled examples addresses a major bottleneck in deploying deep learning models in production environments where log formats change frequently.
  • The Triple Threat: Ablation studies confirmed that GLAD’s performance relies on the integration of structural (GNN), semantic (Sentence-BERT), and temporal (Transformer) components. Removing any of these elements leads to a significant degradation in detection accuracy.

Conclusion and Future Work

GLAD represents a significant step forward in moving beyond simple sequence modeling for log analysis. While the framework currently relies on initial log parsers like Drain, future iterations could explore more integrated parsing and detection. Additionally, the authors aim to extend GLAD’s capabilities toward root cause analysis, leveraging the graph structure to point directly to the anomalous edge or node that triggered the alert, thereby reducing the mean time to resolution (MTTR) for system administrators.

Summary updated

BibTeX
@inproceedings{li2023glad,
  author = {Yufei Li and Yanchi Liu and Haoyu Wang and Zhengzhang Chen and Wei Cheng and Yuncong Chen and Wenchao Yu and Haifeng Chen and Cong Liu},
  title = {{GLAD: Content-Aware Dynamic Graphs For Log Anomaly Detection}},
  booktitle = {ICKG},
  year = {2023},
  url = {https://openreview.net/forum?id=js29_HyWAmL},
}
Figure