[论文解读] Prompting for Automatic Log Template Extraction
该论文提出 LogDiv,一种无需微调的日志解析框架,通过利用大型语言模型(LLMs)的上下文学习能力,对多样化且具有代表性的日志样本进行提示(prompting),以提取日志模板。在不进行模型微调的情况下,LogDiv 在 16 个公开数据集上实现了最先进性能,日志解析准确率达到 97.7%,模板精确率准确率达到 88.1%,模板召回率准确率达到 90.8%。
Log parsing, which involves log template extraction from semi-structured logs to produce structured logs, is the first and the most critical step in automated log analysis. However, current log parsers suffer from limited effectiveness for two reasons. First, traditional data-driven log parsers solely rely on heuristics or handcrafted features designed by domain experts, which may not consistently perform well on logs from diverse systems. Second, existing supervised log parsers require model tuning, which is often limited to fixed training samples and causes sub-optimal performance across the entire log source. To address this limitation, we propose DivLog, an effective log parsing framework based on the in-context learning (ICL) ability of large language models (LLMs). Specifically, before log parsing, DivLog samples a small amount of offline logs as candidates by maximizing their diversity. Then, during log parsing, DivLog selects five appropriate labeled candidates as examples for each target log and constructs them into a prompt. By mining the semantics of examples in the prompt, DivLog generates a target log template in a training-free manner. In addition, we design a straightforward yet effective prompt format to extract the output and enhance the quality of the generated log templates. We conducted experiments on 16 widely-used public datasets. The results show that DivLog achieves (1) 98.1% Parsing Accuracy, (2) 92.1% Precision Template Accuracy, and (3) 92.9% Recall Template Accuracy on average, exhibiting state-of-the-art performance.
研究动机与目标
- 解决传统日志解析器依赖启发式规则或领域特定特征所带来的局限性。
- 克服基于深度学习的解析器在有限训练数据上微调时导致的泛化性能不佳问题。
- 开发一种利用 LLM 上下文学习能力、无需微调的日志解析框架。
- 在具有可变模板结构和不平衡分布的多样化日志源中提升鲁棒性和准确性。
- 设计一种提示格式,以提升输出质量并确保日志模板生成的一致性。
提出的方法
- LogDiv 使用 GPT-3 作为主干 LLM,通过上下文学习实现日志模板生成。
- 从日志消息中选取多样化子集,构成候选提示演示集合。
- 针对每个目标日志消息,基于语义相似度从候选集中检索最相似的前五个日志。
- 将检索到的日志及其对应模板组织成专门的提示格式,以引导 LLM 的输出。
- 该提示格式专门设计用于约束 LLM 输出符合有效日志模板语法,从而提升可靠性和质量。
- LogDiv 通过 LLM 推理生成最终日志模板,无需任何模型微调或重训练。
实验结果
研究问题
- RQ1在不进行模型微调或手工设计特征的情况下,LLM 的上下文学习能否有效提取日志模板?
- RQ2LogDiv 在具有可变模板复杂度和不平衡分布的多样化日志源中表现如何?
- RQ3精心设计的提示格式能否提升 LLM 生成日志模板的质量与一致性?
- RQ4与现有无监督和有监督日志解析器相比,LogDiv 在解析准确率和鲁棒性方面表现如何?
- RQ5LogDiv 能否在日志模式高度可变且低频模板较多的数据集中实现良好泛化?
主要发现
- LogDiv 在 16 个公开数据集上实现了 97.7% 的日志解析准确率,优于现有方法。
- 其模板精确率准确率达到 88.1%,显著高于以往最先进方法。
- 模板召回率准确率达到 90.8%,表明对罕见和复杂日志模板具有强大覆盖能力。
- 与最佳基线相比,LogDiv 在日志解析准确率上提升 3.86 个百分点,模板精确率准确率提升 20.4 个百分点,模板召回率准确率提升 16.7 个百分点。
- 该框架在模板多样性高且日志频率分布不平衡的数据集(如 Mac 和 Proxifier)上表现出稳健性能。
- 消融实验证实,提示设计与基于多样性的示例选择对高性能至关重要。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。