Logcode: Source Code-Driven Log Parsing for Rare Patterns
摘要
Log messages generated by software systems are a rich source of runtime information. This information plays a vital role in enabling developers to maintain systems and diagnose faults effectively. Log parsing is a fundamental prerequisite for downstream tasks. However, existing log parsers rely heavily on large volumes of historical data for feature extraction or model training, and their performance tends to degrade when handling complex or rare log patterns. To address these challenges, we propose Logcode, a novel approach that constructs a diverse dataset by extracting log templates directly from source code. Additionally, Logcode fine-tunes pre-trained models using the diverse dataset, effectively improving the parsing of rare logs. We conduct extensive evaluations on public datasets, and the experimental results demonstrate that Logcode is an effective log parser.