System logs contain rich information for monitoring system operation. Although existing deep learning models have achieved significant success in log anomaly detection, sequence-type log data have not yet clearly learned the local and global relationships within sequences, creating a bottleneck in the development of log anomaly detection. To address this issue, we propose a cosine similarity-based hybrid attention mechanism log anomaly detection algorithm, named cosHALog. Firstly, after log parsing, we select three keywords from every log template based on the IDF algorithm, use BERT to extract the semantic information in templates, and then apply PCA for dimensionality reduction. Subsequently, three parallel one-dimensional convolutional neural networks are employed to learn local relationships in the sequence, combined with a simple additive attention mechanism to assist CNNs in learning. Finally, inspired by cosine similarity and Knowledge Distillation, we optimize the Vaswani attention mechanism to make it a parameter-free attention mechanism and use cosine similarity to measure the relationships between sequence nodes, thereby facilitating GRU to capture global relationships. To evaluate the performance of the cosHALog model, we compare it with the other eight hybrid attention mechanisms to select the most suitable attention mechanisms for learning local and global relationships. Meanwhile, we also compare cosHALog with four benchmark models. The experimental results show that, compared with DeepLog, CNN, LogAnomaly, and LogRobust, our proposed method achieves an average improvement of 4.50%, 1.51%, 5.60%, and 3.09% in F1 score, respectively. All experiments in this paper are conducted on the HDFS and BGL datasets.
Our source code and datasets are freely available on https://github.com/Lxc2git/cosHALog.git
If you have any questions about submitting your review, please email us at [email protected].