SENTRY: an adversarial robust anomaly detection approach in system log based on pattern unit extraction and time-step masking
摘要
Anomaly detection in system logs is critical for monitoring modern software systems and identifying abnormal behaviors associated with reliability incidents and security violations. While dynamic analysis and deep learning-based detectors have achieved strong performance, they remain vulnerable to adversarial perturbations that manipulate observable log sequences through execution-level behavior morphing. To address this challenge, we propose SENTRY, an adversarially robust log-sequence anomaly detection framework that integrates shapelet-based pattern unit extraction, confidence-guided time-step masking, and teacher–student knowledge distillation with difficult-sample learning. Specifically, we enhance the shapelet algorithm with a customized matching-based distance metric to extract discriminative pattern units from categorical event-ID sequences, and reconstruct log sequences to suppress adversarial noise. The reconstructed sequences are then processed by a sequence model equipped with a confidence-guided masking mechanism that reweights each time step according to its normality confidence, thereby emphasizing anomaly-relevant evidence under camouflage attacks. Finally, SENTRY improves robustness via a difficulty-aware distillation strategy that guides the student model to learn from hard and misclassified cases, stabilizing decision behavior under diverse attacks. Extensive experiments on three real-world log datasets demonstrate that SENTRY consistently outperforms strong baselines on both clean and adversarial inputs, and additional studies on alternative backbones further validate the generalizability of the proposed framework.