[论文解读] Logram: Efficient Log Parsing Using n-Gram Dictionaries
Logram 提出了一种高效的日志解析方法,利用 n-gram 词典区分日志中的静态模板与动态变量,实现了更高的准确率,并且解析速度比当前最先进方法快 1.8–5.1 倍。该方法可在 Spark 上实现可扩展的近线性分片解析,并支持实时在线解析,且准确率损失极小。
Software systems usually record important runtime information in their logs. Logs help practitioners understand system runtime behaviors and diagnose field failures. As logs are usually very large in size, automated log analysis is needed to assist practitioners in their software operation and maintenance efforts. Typically, the first step of automated log analysis is log parsing, i.e., converting unstructured raw logs into structured data. However, log parsing is challenging, because logs are produced by static templates in the source code (i.e., logging statements) yet the templates are usually inaccessible when parsing logs. Prior work proposed automated log parsing approaches that have achieved high accuracy. However, as the volume of logs grows rapidly in the era of cloud computing, efficiency becomes a major concern in log parsing. In this work, we propose an automated log parsing approach, Logram, which leverages n-gram dictionaries to achieve efficient log parsing. We evaluated Logram on 16 public log datasets and compared Logram with five state-of-the-art log parsing approaches. We found that Logram achieves a similar parsing accuracy to the best existing approaches while outperforms these approaches in efficiency (i.e., 1.8 to 5.1 times faster than the second fastest approaches). Furthermore, we deployed Logram on Spark and we found that Logram scales out efficiently with the number of Spark nodes (e.g., with near-linear scalability) without sacrificing parsing accuracy. In addition, we demonstrated that Logram can support effective online parsing of logs, achieving similar parsing results and efficiency with the offline mode.
研究动机与目标
- 解决在云环境和大数据环境中高效解析大规模日志的日益增长的挑战。
- 克服临时正则表达式和现有自动化日志解析器在速度和可扩展性方面的局限性。
- 实现可在 Spark 等分布式系统中高效扩展的高准确率日志解析。
- 通过增量更新 n-gram 词典而无需重新处理,支持实时在线日志解析。
- 证明 n-gram 技术(通常用于自然语言处理)可有效建模机器生成的日志内容以实现解析。
提出的方法
- 通过统计日志消息中 n-gram(如 2-gram、3-gram)的频率来构建 n-gram 词典。
- 使用频率阈值将高频 n-gram 分类为静态模板组件,将低频 n-gram 分类为动态变量。
- 通过将 n-gram 与词典匹配来解析日志,提取结构化字段(静态文本、变量、元数据)。
- 在 Spark 等分布式环境中通过并行构建和聚合词典实现可扩展性。
- 通过在新日志流到达时增量更新 n-gram 词典,支持在线解析。
- 采用阈值策略,基于 n-gram 频率动态确定静态与动态标记之间的分界。
实验结果
研究问题
- RQ1n-gram 频率分析能否有效区分非结构化日志中的静态日志模板与动态变量?
- RQ2Logram 在不同日志数据集上的解析准确率和速度与最先进日志解析工具相比如何?
- RQ3Logram 在 Spark 等分布式环境中的可扩展性如何?
- RQ4Logram 在实时流式日志解析场景中能否保持高准确率和高效率?
- RQ5基于 n-gram 的方法在不同领域和系统生成的日志中是否具有鲁棒性?
主要发现
- 在 16 个公开日志数据集上,Logram 的解析准确率高于现有最佳日志解析方法。
- 在端到端解析时间上,Logram 比第二快的现有方法快 1.8 至 5.1 倍。
- Logram 在 Spark 集群上表现出近线性可扩展性,且解析准确率无损失。
- Logram 的在线模式在解析结果和效率上与离线模式相当,某些情况下甚至更快,因为其词典更小、增量更新。
- 在线与离线模式之间的效率差异比率在 -3.0% 至 8.9% 之间,大多数数据集上的一致率高达 95–100%。
- Logram 是首个成功将 n-gram 建模应用于日志解析的方法,充分利用了日志内容中自然语言与人工语言特征的混合特性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。