A GNN-Based Log Anomaly Detection Framework with Prompt Learning for Edge Computing
Abstract
1. Introduction
- We propose a graph-based anomaly detection model for edge computing. Log events and fields are uniformly incorporated into the attribute-enhanced weighted directed log graph, and the nodes are embedded with contextual semantic information. It significantly improves the ability to identify complex structural anomaly patterns.
- We propose a prompt-based few-shot field extraction module that formulates log field identification as a prompt-driven sequence generation task. By leveraging the semantic capabilities of pre-trained language model, it achieves precise extraction of key fields while substantially reducing reliance on handcrafted rules and large-scale annotated data.
- We formalize log anomaly detection as a graph-level anomaly detection problem to achieve end-to-end collaborative optimization of unsupervised graph representation learning and anomaly detection. It not only identifies isolated event anomalies but also effectively captures structural deviations across events and fields, enhancing the accuracy of anomaly detection tasks.
2. Related Work
2.1. Probability-Based Log Detection
2.2. Sequence-Based Log Detection
2.3. Graph-Based Log Detection
3. Problem Definition
4. Methodology
4.1. Prompt-Based Few-Shot Field Extraction
4.2. Log Graph Construction
4.2.1. Graph Structure Configuration
4.2.2. Graph Node Attribute Configuration
4.3. Graph-Based Anomaly Detection for Event Logs
5. Experiments and Analysis of Results
5.1. Experimental Setup
5.1.1. Datasets
5.1.2. Baselines
5.1.3. Evaluation Metrics
5.2. Model Implementation and Configuration
5.3. Experimental Results and Analysis
5.3.1. Overall Performance
5.3.2. Ablation Study
5.3.3. Parameter Sensitivity Analysis
5.3.4. Efficiency Analysis
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Wang, Z.; Tian, J.; Fang, H.; Chen, L.; Qin, J. LightLog: A lightweight temporal convolutional network for log anomaly detection on the edge. Comput. Netw. 2022, 203, 108616. [Google Scholar] [CrossRef]
- Nguyen, T.A.; Le, L.T.; Nguyen, T.D.; Bao, W.; Seneviratne, S.; Hong, C.S.; Tran, N.H. Federated PCA on Grassmann Manifold for IoT Anomaly Detection. IEEE/ACM Trans. Netw. 2024, 32, 4456–4471. [Google Scholar] [CrossRef]
- Li, Z.; Leeuwen, V.M. Feature selection for fault detection and prediction based on event log analysis. ACM SIGKDD Explor. Newsl. 2022, 24, 96–104. [Google Scholar] [CrossRef]
- Zhang, W.; Zhang, Q.; Yu, E.; Ren, Y.; Meng, Y.; Qiu, M.; Wang, J. LogRAG: Semi-Supervised Log-based Anomaly Detection with Retrieval-Augmented Generation. In Proceedings of the IEEE International Conference on Web Services (ICWS), Shenzhen, China, 7–13 July 2024; pp. 1100–1102. [Google Scholar]
- Gan, W.; Chen, L.; Wan, S.; Chen, J.; Chen, C.M. Anomaly rule detection in sequence data. IEEE Trans. Knowl. Data Eng. 2021, 35, 12095–12108. [Google Scholar] [CrossRef]
- Liu, J.; Huang, J.; Huo, Y.; Jiang, Z.; Gu, J.; Chen, Z.; Feng, C.; Yan, M.; Lyu, M.R. Log-based Anomaly Detection based on EVT Theory with feedback. arXiv 2023, arXiv:2306.05032. [Google Scholar] [CrossRef]
- Luo, R.; Krishnamurthy, V. Fréchet-Statistics-Based Change Point Detection in Dynamic Social Networks. IEEE Trans. Comput. Soc. Syst. 2024, 11, 2863–2871. [Google Scholar] [CrossRef]
- Du, M.; Li, F.; Zheng, G.; Srikumar, V. Deeplog: Anomaly detection and diagnosis from system logs through deep learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, Dallas, TX, USA, 30 October–3 November 2017; pp. 1285–1298. [Google Scholar]
- Meng, W.; Liu, Y.; Zhu, S.; Zhang, S.; Pei, D.; Liu, Y.; Chen, Y.; Zhang, R.; Tao, S.; Sun, P.; et al. Loganomaly: Unsupervised detection of sequential and quantitative anomalies in unstructured logs. In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI), Macao, China, 10–16 August 2019; Volume 19, pp. 4739–4745. [Google Scholar]
- Xu, W.; Huang, L.; Fox, A.; Patterson, D.; Jordan, M. Largescale system problem detection by mining console logs. In Proceedings of the SOSP, Big Sky, MT, USA, 11–14 October 2009; Volume 9, pp. 1–17. [Google Scholar]
- Lin, Q.; Zhang, H.; Lou, J.G.; Zhang, Y.; Chen, X. Log clustering based problem identification for online service systems. In Proceedings of the 38th International Conference on Software Engineering Companion, Austin, TX, USA, 14–22 May 2016; pp. 102–111. [Google Scholar]
- He, S.; Lin, Q.; Lou, J.G.; Zhang, H.; Lyu, M.R.; Zhang, D. Identifying impactful service system problems via log analysis. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Lake Buena Vista, FL, USA, 4–9 November 2018; pp. 60–70. [Google Scholar]
- Zhang, X.; Xu, Y.; Lin, Q.; Qiao, B.; Dang, Y.; Xie, C.; Cheng, Q.; Li, Z.; Chen, J.; He, X.; et al. Robust log-based anomaly detection on unstable log data. In Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Tallinn, Estonia, 26–30 August 2019; pp. 807–817. [Google Scholar]
- Yang, L.; Chen, J.; Wang, Z.; Wang, W.; Jiang, J.; Dong, X.; Zhang, W. Semi-supervised log-based anomaly detection via probabilistic label estimation. In Proceedings of the IEEE/ACM 43rd International Conference on Software Engineering (ICSE), Madrid, Spain, 25–28 May 2021; pp. 1448–1460. [Google Scholar]
- Ma, R.; Pang, G.; Chen, L.; Van Den Hengel, A. Deep graphlevel anomaly detection by glocal knowledge distillation. In Proceedings of the Fifteenth ACM International Conference on Web Search and Data Mining, Tempe, AZ, USA, 21–25 February 2022; pp. 704–714. [Google Scholar]
- Qiu, C.; Kloft, M.; Mandt, S.; Rudolph, M. Raising the bar in graph-level anomaly detection. arXiv 2022, arXiv:2205.13845. [Google Scholar] [CrossRef]
- Zhang, G.; Yang, Z.; Wu, J.; Yang, J.; Xue, S.; Peng, H.; Su, J.; Zhou, C.; Sheng, Q.Z.; Akoglu, L.; et al. Dual-discriminative graph neural network for imbalanced graph-level anomaly detection. Adv. Neural Inf. Process. Syst. 2022, 35, 24144–24157. [Google Scholar]
- Nguyen, H.T.; Liang, P.J.; Akoglu, L. Detecting anomalous graphs in labeled multi-graph databases. ACM Trans. Knowl. Discov. Data 2023, 17, 1–25. [Google Scholar] [CrossRef]
- Hamilton, W.L.; Ying, Z.; Leskovec, J. Inductive representation learning on large graphs. Adv. Neural Inf. Process. Syst. 2017, 30. [Google Scholar]
- Veličković, P.; Cucurull, G.; Casanova, A.; Romero, A.; Lio, P.; Bengio, Y. Graph attention networks. arXiv 2017, arXiv:1710.10903. [Google Scholar]
- Shi, Y.; Huang, Z.; Feng, S.; Zhong, H.; Wang, W.; Sun, Y. Masked label prediction: Unified message passing model for semi-supervised classification. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence (IJCAI), Montreal, QC, Canada, 19–27 August 2021. [Google Scholar]
- Liu, F.T.; Ting, K.M.; Zhou, Z.H. Isolation-based anomaly detection. ACM Trans. Knowl. Discov. Data (TKDD) 2012, 6, 1–39. [Google Scholar] [CrossRef]
- He, P.; Zhu, J.; Zheng, Z.; Lyu, M.R. Drain: An online log parsing approach with fixed depth tree. In Proceedings of the IEEE International Conference on Web Services (ICWS), Honolulu, HI, USA, 25–30 June 2017; pp. 33–40. [Google Scholar]
- Oliner, A.; Stearley, J. What supercomputers say: A study of five system logs. In Proceedings of the 37th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN’07), Edinburgh, UK, 25–28 June 2007; pp. 575–584. [Google Scholar]
- Zhu, J.; He, S.; Liu, J.; He, P.; Xie, Q.; Zheng, Z.; Lyu, M.R. Tools and benchmarks for automated log parsing. In Proceedings of the 2019 IEEE/ACM 41st International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), Montreal, QC, Canada, 25–31 May 2019; pp. 121–130. [Google Scholar]
- Wang, F.; Bundy, A.; Li, X.; Zhu, R.; Mauceri, S.; Xu, L.; Wang, F.; Pan, Z.J. LEKG: A system for constructing knowledge graphs from log extraction. In Proceedings of the 10th International Joint Conference on Knowledge Graphs; ACM: New York, NY, USA, 2022; pp. 181–185. [Google Scholar]
- Ekelhart, A.; Ekaputra, F.J.; Kiesling, E. The slogert framework for automated log knowledge graph construction. In European Semantic Web Conference; Springer International Publishing: Cham, Switzerland, 2021; pp. 631–646. [Google Scholar]
- Kurniawan, K.; Ekelhart, A.; Kiesling, E.; Winkler, D.; Quirchmayr, G.; Tjoa, A.M. Virtual knowledge graphs for federated log analysis. In Proceedings of the 16th International Conference on Availability, Reliability and Security, Virtually, 17–20 August 2021; pp. 1–11. [Google Scholar]
- Cui, L.; Wu, Y.; Liu, J.; Yang, S.; Zhang, Y. Template-based named entity recognition using BART. arXiv 2021, arXiv:2106.01760. [Google Scholar] [CrossRef]
- Reimers, N.; Gurevych, I. Sentence-bert: Sentence embeddings using siamese bert-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP); Association for Computational Linguistics: Kerrville, TX, USA, 2019; pp. 3982–3992. [Google Scholar]
- Li, Y.; Yu, X.; Liu, Y.; Chen, H.; Liu, C. Uncertainty-aware bootstrap learning for joint extraction on distantly-supervised data. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, Toronto, ON, Canada, 9–14 July 2023; pp. 1349–1358. [Google Scholar]
- Tong, Z.; Liang, Y.; Sun, C.; Li, X.; Rosenblum, D.; Lim, A. Digraph inception convolutional networks. In Proceedings of the Advances in Neural Information Processing Systems, Virtually, 6–12 December 2020; pp. 17907–17918. [Google Scholar]
- Gilmer, J.; Schoenholz, S.S.; Riley, P.F.; Vinyals, O.; Dahl, G.E. Neural message passing for quantum chemistry. In Proceedings of the International Conference on Machine Learning, Sydney, Australia, 6–11 August 2017; pp. 1263–1272. [Google Scholar]
- Xu, W.; Huang, L.; Fox, A.; Patterson, D.; Jordan, M.I. Detecting large-scale system problems by mining console logs. In Proceedings of the ACM SIGOPS 22nd Symposium on Operating Systems Principles, Big Sky, MT, USA, 11–14 October 2009; pp. 117–132. [Google Scholar]
- Zhang, C.; Wang, X.; Zhang, H.; Zhang, H.; Han, P. Log sequence anomaly detection based on local information extraction and globally sparse transformer model. IEEE Trans. Netw. Serv. Manag. 2021, 18, 4119–4133. [Google Scholar] [CrossRef]
- Miao, X.; Liu, Y.; Zhao, H.; Li, C. Distributed online one-class support vector machine for anomaly detection over networks. IEEE Trans. Cybern. 2018, 49, 1475–1488. [Google Scholar] [CrossRef] [PubMed]
- Zhang, C.; Peng, X.; Sha, C.; Zhang, K.; Fu, Z.; Wu, X.; Lin, Q.; Zhang, D. Deeptralog: Trace-log combined microservice anomaly detection through graph-based deep learning. In Proceedings of the 44th International Conference on Software Engineering, Pittsburgh, PA, USA, 22–24 May 2022; pp. 623–634. [Google Scholar]
- Yang, H.; Sun, D.; Wang, Y.; Huang, W. DSGN: Log-based anomaly diagnosis with dynamic semantic gate networks. Inf. Sci. 2024, 680, 121174. [Google Scholar] [CrossRef]






| Name | #Events | #Graphs | #Anomalies | #Nodes | #Edges |
|---|---|---|---|---|---|
| HDFS | 48 | 575,061 | 16,838 | 7 | 20 |
| BGL | 1848 | 69,251 | 31,374 | 10 | 30 |
| Thunderbird | 1013 | 52,160 | 6,814 | 16 | 52 |
| Method | HDFS | BGL | Thunderbird | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Precision | Recall | F1 | Precision | Recall | F1 | Precision | Recall | F1 | |
| PCA | 0.74 | 0.82 | 0.78 | 0.81 | 0.94 | 0.87 | 0.34 | 0.91 | 0.49 |
| OCSVM | 0.63 | 0.79 | 0.70 | 0.63 | 0.73 | 0.68 | 0.44 | 0.87 | 0.58 |
| DeepLog | 0.83 | 0.87 | 0.85 | 0.89 | 0.80 | 0.84 | 0.48 | 0.89 | 0.62 |
| LogAnomaly | 0.86 | 0.89 | 0.87 | 0.91 | 0.79 | 0.84 | 0.51 | 0.87 | 0.64 |
| PLELog | 0.88 | 0.93 | 0.90 | 0.92 | 0.96 | 0.94 | 0.85 | 0.94 | 0.89 |
| DeepTraLog | 0.89 | 0.91 | 0.90 | 0.86 | 0.89 | 0.87 | 0.87 | 0.87 | 0.87 |
| DSGN | 0.88 | 0.87 | 0.87 | 0.79 | 0.92 | 0.85 | 0.86 | 0.94 | 0.90 |
| Ours | 0.90 | 0.95 | 0.92 | 0.93 | 0.97 | 0.95 | 0.92 | 0.96 | 0.93 |
| Prompt Type | ||
|---|---|---|
| Prompt | <candidate_span> is a/an <entity_type> entity | <candidate_span> is not a named entity |
| Prompt | <entity_type>candidate_span> | <candidate_span>=none |
| Technique | Precision | Recall | -Score | |
|---|---|---|---|---|
| regex | 36.48 | 44.28 | 40.00 | |
| 1-shot | 16.53 | 59.34 | 25.86 | |
| 5-shot | 28.33 | 74.38 | 41.03 | |
| 10-shot | 66.28 | 85.22 | 74.57 | |
| 1-shot | 17.89 | 58.14 | 27.36 | |
| 5-shot | 28.00 | 73.76 | 40.59 | |
| 10-shot | 64.68 | 87.82 | 74.49 | |
| PCA | OCSVM | DeepLog | LogAnomaly | PLELog | DeepTraLog | DSGN | Our | |
|---|---|---|---|---|---|---|---|---|
| Training Time | 87.36 s | 235.79 s | 2321.21 s | 4420.02 s | 1648.37 s | 1261.55 s | 1753.82 s | 1578.52 s |
| Testing Time | 0.61 s | 107.13 s | 1595.18 s | 2625.36 s | 894.56 s | 796.81 s | 1050.07 s | 986.33 s |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Hu, X.; Feng, G.; Huang, X.; Kong, X.; Lv, H. A GNN-Based Log Anomaly Detection Framework with Prompt Learning for Edge Computing. Computers 2026, 15, 273. https://doi.org/10.3390/computers15050273
Hu X, Feng G, Huang X, Kong X, Lv H. A GNN-Based Log Anomaly Detection Framework with Prompt Learning for Edge Computing. Computers. 2026; 15(5):273. https://doi.org/10.3390/computers15050273
Chicago/Turabian StyleHu, Xianlang, Guangsheng Feng, Xinling Huang, Xiangying Kong, and Hongwu Lv. 2026. "A GNN-Based Log Anomaly Detection Framework with Prompt Learning for Edge Computing" Computers 15, no. 5: 273. https://doi.org/10.3390/computers15050273
APA StyleHu, X., Feng, G., Huang, X., Kong, X., & Lv, H. (2026). A GNN-Based Log Anomaly Detection Framework with Prompt Learning for Edge Computing. Computers, 15(5), 273. https://doi.org/10.3390/computers15050273

