[Paper Review] Logram: Efficient Log Parsing Using n-Gram Dictionaries
Logram proposes an efficient log parsing approach using n-gram dictionaries to distinguish static templates from dynamic variables in logs, achieving higher accuracy and 1.8–5.1× faster parsing than state-of-the-art methods. It enables scalable, near-linearly sharded parsing on Spark and supports real-time online parsing with minimal accuracy loss.
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.
Motivation & Objective
- Address the growing challenge of parsing large-scale logs efficiently in cloud and big data environments.
- Overcome the limitations of ad hoc regular expressions and existing automated log parsers that are slow or lack scalability.
- Enable high-accuracy log parsing that scales efficiently across distributed systems like Spark.
- Support real-time, online log parsing by incrementally updating n-gram dictionaries without reprocessing.
- Demonstrate that n-grams, typically used in NLP, can effectively model machine-generated log content for parsing.
Proposed method
- Construct n-gram dictionaries by counting frequencies of n-grams (e.g., 2-grams, 3-grams) across log messages.
- Use frequency thresholds to classify frequent n-grams as static template components and rare n-grams as dynamic variables.
- Parse logs by matching n-grams against the dictionary, extracting structured fields (static text, variables, metadata).
- Enable parallel dictionary construction and aggregation for scalability in distributed environments like Spark.
- Support online parsing by incrementally updating the n-gram dictionary as new log streams arrive.
- Use a thresholding strategy to dynamically determine the boundary between static and dynamic tokens based on n-gram frequency.
Experimental results
Research questions
- RQ1Can n-gram frequency analysis effectively distinguish static log templates from dynamic variables in unstructured logs?
- RQ2How does Logram’s parsing accuracy and speed compare to state-of-the-art log parsing tools across diverse log datasets?
- RQ3To what extent can Logram scale efficiently in distributed environments like Spark clusters?
- RQ4Can Logram maintain high accuracy and efficiency in online, streaming log parsing scenarios?
- RQ5Is the n-gram-based approach robust across logs from different domains and systems?
Key findings
- Logram achieves higher parsing accuracy than the best existing log parsing approaches on 16 public log datasets.
- Logram is 1.8 to 5.1 times faster than the second-fastest existing approach in end-to-end parsing time.
- Logram demonstrates near-linear scalability on Spark clusters, with no loss in parsing accuracy.
- The online mode of Logram achieves parsing results and efficiency comparable to the offline mode, with some cases being faster due to smaller, incremental dictionaries.
- Efficiency difference ratios between online and offline modes range from -3.0% to 8.9%, with agreement rates of 95–100% on most datasets.
- Logram is the first approach to successfully apply n-gram modeling to log parsing, leveraging the mix of natural and artificial characteristics in log content.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.