Skip to main content
QUICK REVIEW

[Paper Review] LogBERT: Log Anomaly Detection via BERT

Haixuan Guo, Yuan, Shuhan|arXiv (Cornell University)|Mar 7, 2021
Software System Performance and ReliabilityComputer Science24 references7 citations
TL;DR

LogBERT proposes a self-supervised BERT-based framework for log anomaly detection, leveraging masked log key prediction and hypersphere volume minimization to learn normal sequence patterns. It outperforms state-of-the-art methods on three benchmark datasets, achieving F1 scores up to 96.64 on Thunderbird and 82.32 on HDFS.

ABSTRACT

Detecting anomalous events in online computer systems is crucial to protect the systems from malicious attacks or malfunctions. System logs, which record detailed information of computational events, are widely used for system status analysis. In this paper, we propose LogBERT, a self-supervised framework for log anomaly detection based on Bidirectional Encoder Representations from Transformers (BERT). LogBERT learns the patterns of normal log sequences by two novel self-supervised training tasks and is able to detect anomalies where the underlying patterns deviate from normal log sequences. The experimental results on three log datasets show that LogBERT outperforms state-of-the-art approaches for anomaly detection.

Motivation & Objective

  • To address the limitations of RNN-based models in capturing bidirectional context and global sequence patterns in log sequences.
  • To develop a self-supervised framework that learns normal log patterns without requiring labeled anomalies.
  • To improve anomaly detection performance by combining two novel pretraining tasks: masked log key prediction and hypersphere volume minimization.
  • To enable effective detection of anomalous log sequences even in short or complex sequences where traditional models fail.

Proposed method

  • Uses a BERT-style Transformer encoder to model log sequences with bidirectional context encoding.
  • Applies a masked log key prediction task to predict randomly masked log keys in normal sequences.
  • Introduces volume of hypersphere minimization to cluster normal log sequence representations in embedding space.
  • Employs a special [DIST] token to represent the entire log sequence for anomaly scoring.
  • Combines both self-supervised tasks during pretraining to learn robust normal sequence representations.
  • Uses the distance of a sequence’s [DIST] token embedding from the centroid of normal sequences as an anomaly score.

Experimental results

Research questions

  • RQ1Can a BERT-based model effectively learn normal log sequence patterns through self-supervised pretraining?
  • RQ2Does combining masked log key prediction with hypersphere volume minimization improve anomaly detection performance compared to single-objective pretraining?
  • RQ3How does LogBERT perform on diverse log datasets with varying sequence lengths and normal/anomaly ratios?
  • RQ4To what extent do the two self-supervised pretraining tasks contribute to representation learning and anomaly detection?
  • RQ5Can the model generalize to unseen anomalous patterns not seen during pretraining?

Key findings

  • LogBERT achieves an F1 score of 96.64 on the Thunderbird dataset, outperforming all baselines.
  • On the HDFS dataset, LogBERT reaches an F1 score of 82.32 when trained with both self-supervised tasks, a significant improvement over single-task training.
  • The ablation study shows that combining both pretraining tasks yields better performance than using either task alone, especially on shorter sequences.
  • Visualization using LLE confirms that the hypersphere volume minimization task effectively separates normal and anomalous sequences in the latent space.
  • Parameter analysis reveals that a mask ratio of 0.1 to 0.5 improves performance, while higher ratios degrade it due to information loss.
  • The model is robust to hyperparameter tuning, with stable performance across different α values and candidate set sizes.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.