LogELECTRA: Self-supervised Anomaly Detection for Unstructured Logs

Yuki Yamanaka, Tomokatsu Takahashi, Takuya Minami, Yoshiaki NakajimaarXiv 2024

Abstract

System logs are some of the most important information for the maintenance of software systems, which have become larger and more complex in recent years. The goal of log-based anomaly detection is to automatically detect system anomalies by analyzing the large number of logs generated in a short period of time, which is a critical challenge in the real world. Previous studies have used a log parser to extract templates from unstructured log data and detect anomalies on the basis of patterns of the template occurrences. These methods have limitations for logs with unknown templates. Furthermore, since most log anomalies are known to be point anomalies rather than contextual anomalies, detection methods based on occurrence patterns can cause unnecessary delays in detection. In this paper, we propose LogELECTRA, a new log anomaly detection model that analyzes a single line of log messages more deeply on the basis of self-supervised anomaly detection. LogELECTRA specializes in detecting log anomalies as point anomalies by applying ELECTRA, a natural language processing model, to analyze the semantics of a single line of log messages. LogELECTRA outperformed existing state-of-the-art methods in experiments on the public benchmark log datasets BGL, Sprit, and Thunderbird.

Introduction

Modern software systems generate massive volumes of logs, making manual monitoring impossible. Traditionally, automated log analysis follows a two-step "parse-then-detect" pipeline: first, log parsing converts unstructured text into templates; second, anomaly detection analyzes the sequence or frequency of these templates. However, this approach is brittle. Log parsers often fail on unseen formats and discard critical parameters like IP addresses or error codes. Furthermore, many existing models focus on contextual anomalies over time, introducing detection lag. In reality, many system errors are point anomalies—single lines that are inherently anomalous regardless of context.

Methodology

LogELECTRA treats log anomaly detection as a natural language processing (NLP) problem, utilizing a parser-free approach that processes raw text directly.

Architecture

The model is based on the ELECTRA architecture, which employs two Transformer models in a self-supervised framework:

  • The Generator: A small Masked Language Model (MLM) that predicts hidden tokens in a log line.
  • The Discriminator: The core detection component that determines whether each token in a line is original or has been replaced by the generator.
The LogELECTRA architecture featuring a Generator and a Discriminator for Replaced Token Detection.

During training, the discriminator learns the semantics of "normal" logs. In the evaluation phase, the generator is discarded. The discriminator analyzes new log lines; if tokens appear out of context, they are flagged as anomalous. The anomaly score is the average probability that tokens in a line are original.

Experimental Setup

The researchers evaluated LogELECTRA using three massive, public supercomputer log datasets: BGL (Blue Gene/L), Spirit, and Thunderbird. Testing included both random splits and chronological splits, with the latter representing a more realistic real-world scenario where models are trained on past data to predict future anomalies.

Key Results

LogELECTRA significantly outperformed existing unsupervised and semi-supervised models such as DeepLog, LogAnomaly, and PLELog.

Performance comparison of LogELECTRA against baseline models on the BGL dataset.

On the BGL dataset (chronological split), LogELECTRA achieved an F1-score of 0.674, more than doubling the performance of DeepLog (0.317). The model demonstrated high stability across different grouping methods (e.g., 60-minute windows vs. 100-message windows) because it focuses on the semantics of individual lines rather than temporal patterns. Notably, LogELECTRA's performance approached that of supervised models like RobustLog and CNN, despite requiring no labeled anomaly data.

Conclusion

By avoiding the information loss inherent in log parsing and focusing on point anomalies, LogELECTRA provides a more robust and timely solution for system monitoring. It eliminates detection lag by evaluating logs line-by-line and shows superior generalization to new log formats. Future work will explore model transferability between different systems and real-time scalability for production environments.

Summary updated

BibTeX
@misc{yamanaka2024logelectra,
  author = {Yuki Yamanaka and Tomokatsu Takahashi and Takuya Minami and Yoshiaki Nakajima},
  title = {{LogELECTRA: Self-supervised Anomaly Detection for Unstructured Logs}},
  year = {2024},
  eprint = {2402.10397},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.10397},
}
Figure