Abstract
Mining information from logs is an old and still active research topic. In recent years, with the rapid emerging of cloud computing, log mining becomes increasingly important to industry. This paper focus on one major mission of log mining: anomaly detection, and proposes a novel method for mining abnormal sequences from large logs. Different from previous anomaly detection systems which based on statistics, probabilities and Markov assumption, our approach measures the strangeness of a sequence using compression. It first trains a grammar about normal behaviors using grammar-based compression, then measures the information quantities and densities of questionable sequences according to incrementation of grammar length. We have applied our approach on mining some real bugs from fine grained execution logs. We have also tested its ability on intrusion detection using some publicity available system call traces. The experiments show that our method successfully selects the strange sequences which related to bugs or attacking.
Introduction
As cloud computing scales, system logs have become massive and complex. Detecting anomalies—whether they are software bugs or security intrusions—is like finding a needle in a haystack. Traditional approaches usually fall into two camps: Misuse Detection, which looks for known "bad" signatures and fails against zero-day threats, and Anomaly Detection (AID), which models "normal" behavior.
The authors argue that current AID methods, which rely heavily on Markov assumptions (predicting the next state based on the current one), are too "low-level." They are effective at spotting simple transitions but struggle to identify high-level logic errors or complex, non-deterministic bugs like race conditions. This paper introduces a novel anomaly detection method that swaps traditional statistical models for grammar-based compression.
Methodology
The proposed method uses grammar-based compression to measure the "strangeness" of a log sequence. The core intuition is that if a model already "knows" normal behavior, describing a normal sequence should require very few additional symbols. Conversely, an anomaly will contain patterns not present in the training set, requiring a significant increase in the grammar's complexity.
The process follows three steps:
- Training: A set of known normal logs is processed using a greedy grammar transform to create a context-free grammar ($G$) representing the "rules" of normal behavior.
- Evaluating: When a new sequence arrives, it is added to the grammar. The system measures the Information Quantity ($I$)—the number of new symbols needed—and Information Density ($D$)—the average information per log entry.
- Selecting: Sequences with the highest $I$ and $D$ values are flagged as anomalies.
Unlike generic compression tools like gzip, which use a sliding window that "forgets" old data, this method treats each log entry as a distinct "atom" in the grammar. This allows it to capture hierarchical, nested structures in code execution, which is vital for identifying high-level logic flaws.
Experimental Evaluation
The method was evaluated on two distinct types of data: fine-grained execution logs (from lighttpd and memcached) and system call traces (the UNM dataset).
Bug Finding
In the lighttpd experiment, the algorithm successfully flagged two sequences containing a race condition out of 1,000 test requests. In memcached, it correctly identified three buggy sequences related to an incorrect state transfer. These are types of bugs that traditional Markov models often miss due to their limited context.
Intrusion Detection
On the UNM xlock dataset, exploited sequences exhibited an information density ($D$) twice as large as the highest density found in the normal set. The algorithm proved efficient, processing over 9 million entries in the named dataset in approximately 4.3 hours for training and just 3 minutes for evaluation.
Conclusion and Future Work
By using the increment in grammar length as a metric, the authors effectively turn a "big data" problem into a "minimal description length" problem. This approach captures logic flaws that simpler statistical models overlook.
However, several challenges remain. The method currently relies on manual thresholding (reporting the "top $m$" strange sequences) and assumes a static "normal" training set. Future work could address "concept drift" by updating the grammar incrementally as software evolves. Additionally, the effectiveness of the method depends on logs being pre-processed into meaningful sequences, such as by thread or request ID.
Summary updated