PreLog: Pre-training for Log Analytics
Abstract: Large-scale software-intensive systems often produce a large volume of logs to record runtime status and events for troubleshooting purposes. The rich information in log data enables a variety of system management and diagnosis tasks. Over the years, many approaches have been proposed for automated log analytics. However, these approaches usually design separate models for each specific task, which cannot be generalized to other tasks. They are also not robust when dealing with logs from heterogeneous sources. In this paper, we propose PreLog, a novel pre-trained model for log analytics. PreLog is pre-trained on a large amount of unlabelled log data to capture the semantic meaning of logs. We design two log-specific pre-training objectives, including entry-level and sequence-level objectives, which enable PreLog to better understand the hidden structure and semantic meaning of logs. To perform downstream log analytics tasks, we leverage a prompt tuning paradigm to convert downstream tasks’ objectives into a similar form as the pre-training stage. We have conducted extensive experiments on two main log analytics tasks (i.e., log parsing and log-based anomaly detection). Experimental results show that PreLog achieves better or comparable results in comparison with the state-of-the-art, task-specific approaches. PreLog is cost-effective and can be uniformly applied to many log analytics tasks through the prompt tuning paradigm.
Additional Results:
A. Prompt Tuning vs. Fine-tuning
To demonstrate the benefits of the current prompt tuning design (i.e., hard prompt tuning), we conduct additional experiments on anomaly detection.
We the following settings:
- Hard prompt (i.e., the current design of PreLog): We use the template of "[S] This sequence is [MASK]", where [S] and [MASK] are the unfilled slots for the input log sequence and label, respectively.
- Soft prompt: We use the template of "[S] [SOFT] [SOFT] [SOFT] * 3 [MASK]", where [S] and [MASK] are the unfilled slots for the input log sequence and label, respectively. [SOFT] is a soft/virtual token for soft prompt tuning.
- Fine tune (freeze LM): We freeze the pre-trained PreLog and only fine-tune the classification head.
- Fine tune (full parameters): We add a classification head on top of the pre-trained PreLog and fine-tune all parameters.
A1. Results with stable logs
| Dataset |
Metric |
Hard Prompt (PreLog) |
Soft Prompt |
Fine tune (freeze LM) |
Fine tune (full params) |
| HDFS |
Precision |
0.897 |
0.601 |
0.709 |
0.599 |
|
Recall |
1.0 |
0.953 |
0.504 |
0.988 |
|
F-measure |
0.946 |
0.737 |
0.589 |
0.746 |
| BGL |
Precision |
0.967 |
0.909 |
0.857 |
0.924 |
|
Recall |
0.982 |
0.998 |
0.914 |
0.998 |
|
F-measure |
0.974 |
0.952 |
0.885 |
0.960 |
| Spirit |
Precision |
1.0 |
0.752 |
0.355 |
0.687 |
|
Recall |
0.996 |
0.848 |
0.984 |
0.918 |
|
F-measure |
0.998 |
0.797 |
0.521 |
0.784 |
A2. Results with unstable log events
| Injection Ratio |
Metric |
Hard Prompt (PreLog) |
Soft Prompt |
Fine tune (freeze LM) |
Fine tune (full params) |
| 5% |
Precision |
0.900 |
0.735 |
0.550 |
0.762 |
|
Recall |
0.988 |
0.999 |
0.532 |
0.999 |
|
F-measure |
0.942 |
0.847 |
0.541 |
0.865 |
| 10% |
Precision |
0.897 |
0.748 |
0.259 |
0.748 |
|
Recall |
0.985 |
0.999 |
0.55 |
0.999 |
|
F-measure |
0.939 |
0.855 |
0.351 |
0.856 |
| 15% |
Precision |
0.891 |
0.721 |
0.657 |
0.725 |
|
Recall |
0.986 |
0.999 |
0.872 |
0.999 |
|
F-measure |
0.939 |
0.837 |
0.749 |
0.841 |
| 20% |
Precision |
0.889 |
0.722 |
0.644 |
0.729 |
|
Recall |
0.987 |
0.998 |
0.898 |
0.999 |
|
F-measure |
0.936 |
0.838 |
0.750 |
0.843 |
A3. Results with unstable log sequences
| Injection Ratio |
Metric |
Hard Prompt (PreLog) |
Soft Prompt |
Fine tune (freeze LM) |
Fine tune (full params) |
| 5% |
Precision |
0.903 |
0.735 |
0.688 |
0.814 |
|
Recall |
0.988 |
0.999 |
0.916 |
0.998 |
|
F-measure |
0.943 |
0.847 |
0.786 |
0.897 |
| 10% |
Precision |
0.915 |
0.748 |
0.682 |
0.816 |
|
Recall |
0.988 |
0.999 |
0.916 |
0.998 |
|
F-measure |
0.950 |
0.855 |
0.782 |
0.898 |
| 15% |
Precision |
0.912 |
0.721 |
0.646 |
0.807 |
|
Recall |
0.988 |
0.999 |
0.916 |
0.998 |
|
F-measure |
0.936 |
0.837 |
0.753 |
0.893 |
| 20% |
Precision |
0.905 |
0.722 |
0.593 |
0.804 |
|
Recall |
0.988 |
0.998 |
0.916 |
0.998 |
|
F-measure |
0.945 |
0.838 |
0.720 |
0.891 |
Findings
- PreLog performs the best with hard prompt tuning.
- Fine-tuning with only a small data cannot achieve as good results as hard prompt tuning.
- Soft prompt tuning can achieve similar results as fine-tuning.
- Only fine-tuning the classification head (i.e., freeze LM) perform the worst.
B. Pre-training
To verify the contributions of pre-training, we leverage the model architecture of PreLog to train a model from scratch (w/o pre-training) for anomaly detection.
B1. Results on stable logs
| Dataset |
Metric |
PreLog (w/ Pre-training) |
PreLog (w/o Pre-training) |
| HDFS |
Precision |
0.897 |
0.751 |
|
Recall |
1.0 |
0.987 |
|
F-measure |
0.946 |
0.853 |
| BGL |
Precision |
0.967 |
0.818 |
|
Recall |
0.982 |
0.968 |
|
F-measure |
0.974 |
0.886 |
| Spirit |
Precision |
1.0 |
0.987 |
|
Recall |
0.996 |
0.994 |
|
F-measure |
0.998 |
0.990 |
B2. Results on unstable log events
| Injection Ratio |
Metric |
PreLog (w/ Pre-training) |
PreLog (w/o Pre-training) |
| 5% |
Precision |
0.900 |
0.446 |
|
Recall |
0.988 |
0.959 |
|
F-measure |
0.942 |
0.608 |
| 10% |
Precision |
0.897 |
0.579 |
|
Recall |
0.985 |
0.956 |
|
F-measure |
0.939 |
0.721 |
| 15% |
Precision |
0.891 |
0.453 |
|
Recall |
0.986 |
0.959 |
|
F-measure |
0.939 |
0.616 |
| 20% |
Precision |
0.889 |
0.527 |
|
Recall |
0.987 |
0.955 |
|
F-measure |
0.936 |
0.679 |
B3. Results on unstable log sequences
| Injection Ratio |
Metric |
PreLog (w/ Pre-training) |
PreLog (w/o Pre-training) |
| 5% |
Precision |
0.903 |
0.599 |
|
Recall |
0.988 |
0.967 |
|
F-measure |
0.943 |
0.740 |
| 10% |
Precision |
0.915 |
0.505 |
|
Recall |
0.988 |
0.967 |
|
F-measure |
0.950 |
0.663 |
| 15% |
Precision |
0.912 |
0.549 |
|
Recall |
0.988 |
0.967 |
|
F-measure |
0.936 |
0.700 |
| 20% |
Precision |
0.905 |
0.508 |
|
Recall |
0.988 |
0.967 |