[论文解读] Log-based Anomaly Detection Without Log Parsing
NeuralLog 提出了一种基于日志的异常检测方法,通过直接使用 BERT 将原始日志消息编码为语义向量,绕过了日志解析步骤,然后应用基于 Transformer 的分类器检测异常。该方法在四个公开数据集上实现了超过 0.95 的 F1 分数,优于现有依赖解析的方法,消除了 OOV 词汇和语义误解带来的错误。
Software systems often record important runtime information in system logs for troubleshooting purposes. There have been many studies that use log data to construct machine learning models for detecting system anomalies. Through our empirical study, we find that existing log-based anomaly detection approaches are significantly affected by log parsing errors that are introduced by 1) OOV (out-of-vocabulary) words, and 2) semantic misunderstandings. The log parsing errors could cause the loss of important information for anomaly detection. To address the limitations of existing methods, we propose NeuralLog, a novel log-based anomaly detection approach that does not require log parsing. NeuralLog extracts the semantic meaning of raw log messages and represents them as semantic vectors. These representation vectors are then used to detect anomalies through a Transformer-based classification model, which can capture the contextual information from log sequences. Our experimental results show that the proposed approach can effectively understand the semantic meaning of log messages and achieve accurate anomaly detection results. Overall, NeuralLog achieves F1-scores greater than 0.95 on four public datasets, outperforming the existing approaches.
研究动机与目标
- 研究日志解析错误(尤其是 OOV 词汇和语义误解)对异常检测性能的负面影响。
- 开发一种不依赖日志解析的基于日志的异常检测方法,以保持语义完整性并避免解析引起的语义信息损失。
- 利用 BERT 等预训练语言模型,直接从原始日志消息中提取上下文和语义表示。
- 设计一种序列感知的分类模型,利用 Transformer 检测异常,无需预先定义事件模板。
- 在真实世界数据集上验证所提出方法,并与基于解析的最先进方法相比,展示其优越性能。
提出的方法
- 使用 WordPiece 分词的 BERT 将原始日志消息编码为密集语义向量,有效处理 OOV 词汇,且无需日志解析。
- 将每个原始日志消息视为一个标记序列,并应用预训练的 BERT 模型提取上下文嵌入,以保留语义含义。
- 通过时间分组(例如,使用固定窗口或滑动窗口)构建日志序列,作为异常检测模型的输入序列。
- 采用具有多头自注意力机制的基于 Transformer 的分类器,以建模日志序列之间的长距离依赖关系和上下文关联。
- 使用带标签的日志序列以端到端方式训练模型,异常基于学习到的语义表示中的模式进行识别。
- 避免任何形式的日志模板提取或事件索引,从而消除解析错误并保留完整的语义上下文。

实验结果
研究问题
- RQ1日志解析中的 OOV 词汇和语义误解在多大程度上会降低现有基于日志的异常检测方法的性能?
- RQ2是否能够通过深度学习模型直接处理原始日志消息(无需日志解析)来实现优于依赖解析方法的异常检测性能?
- RQ3BERT 基于的语义编码在多大程度上能有效保留日志消息的上下文和语义含义以用于异常检测?
- RQ4在原始日志嵌入上训练的基于 Transformer 的分类器,是否能优于依赖解析日志事件的模型来检测系统异常?
- RQ5所提出的方法是否能在无需辅助数据或人工模板工程的情况下,泛化到多样化的现实世界日志数据集?
主要发现
- 实证分析表明,日志解析错误(尤其是 OOV 词汇和语义误读)显著降低了现有异常检测模型的性能。
- NeuralLog 在所有四个公开基准数据集上均实现了超过 0.95 的 F1 分数,展示了无需日志解析的高检测精度。
- 该模型优于最先进的基于解析的方法,如 LogRobust、LogAnomaly 和 DeepLog,后者对解析不准确非常敏感。
- 通过使用 BERT 编码原始日志,NeuralLog 有效捕捉了语义含义和上下文关系,即使对于罕见或未见的 OOV 术语亦然。
- 在语义向量上端到端训练的 Transformer 分类器实现了稳健的异常检测,无需日志模板提取或外部数据。
- 该方法高效且可扩展,因为它避免了计算成本高昂的解析步骤,并直接利用预训练的语言表示。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。