Unsupervised-Log-Anomaly-Detection-Microservices README

The project's README from github.com/chuansirrr/Unsupervised-Log-Anomaly-Detection-Microservices. As one markdown file: README.md.

Unsupervised-Log-Anomaly-Detection-Microservices-Advanced

Unsupervised Anomaly Detection for Log Data in Microservice Architectures — Advanced Version

This repository provides a research-grade, unsupervised anomaly detection framework for microservice logs, combining multi-modal embeddings, graph attention networks, hybrid ensembles with GMM thresholding, streaming simulation, and explainability (SHAP + gradients). A minimal Streamlit dashboard is included for real-time visualization.

Key Additions Over the Basic Version

Repository Layout

.
├─ src/
│  ├─ data/
│  │   ├─ parser.py               # Log parsing & templating
│  │   ├─ dataset.py              # Datasets & tokenization
│  │   └─ graph_builder.py        # Build service dependency graphs
│  ├─ models/
│  │   ├─ transformer.py          # Transformer encoder (semantic branch)
│  │   ├─ lstm.py                 # LSTM temporal branch
│  │   ├─ fusion.py               # Feature fusion with attention gating
│  │   ├─ gnn_gat.py              # Graph Attention Network (GAT)
│  │   ├─ autoencoder.py          # Reconstruction head
│  │   └─ ensemble.py             # IsolationForest + GMM thresholding
│  ├─ explain/
│  │   ├─ shap_explain.py         # SHAP explainability for fused features
│  │   └─ grad_tokens.py          # Token-level gradient saliency
│  ├─ streaming/
│  │   └─ collector.py            # Log stream simulator
│  ├─ train.py                    # Unsupervised training pipeline
│  ├─ evaluate.py                 # Evaluation & metrics + thresholding
│  ├─ visualize.py                # Embedding/graph plots
│  └─ dashboard_app.py            # Streamlit dashboard
├─ configs/
│  ├─ base.yaml
│  └─ advanced.yaml
├─ tests/
├─ .github/workflows/python-ci.yml
├─ requirements.txt
├─ LICENSE
└─ CITATION.cff

Quickstart

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

# Train unsupervised (embeddings + AE reconstruction)
python src/train.py --config configs/advanced.yaml

# Evaluate & save anomaly scores + calibrated threshold
python src/evaluate.py --config configs/advanced.yaml

# Explain: SHAP on fused features
python -m src.explain.shap_explain --config configs/advanced.yaml --n_samples 256

# (Optional) Run the dashboard (needs artifacts/ outputs)
streamlit run src/dashboard_app.py -- --config configs/advanced.yaml

Citation

@software{log_ad_microservices_advanced,
  title={Unsupervised Anomaly Detection for Log Data in Microservice Architectures — Advanced},
  year={2025},
  author={Your Name}
}

Unsupervised-Log-Anomaly-Detection-Microservices (chuansirrr/Unsupervised-Log-Anomaly-Detection-Microservices)

Searching Database…

这是什么?这是一个面向微服务日志的研究级无监督异常检测框架,它将 Transformer、LSTM 和统计特征与基于图的建模和集成评分相结合,无需标注数据即可标记异常日志行为。
这是现成的工具,还是我拿来实验的研究代码库?它是一个面向研究的 Python 代码库,捆绑了多个模型(Transformer、LSTM、GAT、Autoencoder、IsolationForest、GMM)和一个极简的 Streamlit 仪表盘,而不是打磨好的一条命令就能用的产品。
运行它需要哪类库(深度学习、可解释性、仪表盘)?由于它把 Transformer 和 LSTM 神经编码器与图注意力网络、Autoencoder、IsolationForest 和 GMM 融合在一起,加上用于可解释性的 SHAP 和用于仪表盘的 Streamlit,你需要一套 Python 深度学习技术栈,并搭配 scikit-learn 风格的库以及 SHAP/Streamlit,不过确切的安装命令并未列出。
这是生产可用的还是更偏实验性的项目?README 明确称它为“研究级”框架,这意味着它是为实验和分析而构建的,而不是加固过的生产部署。
图注意力网络(GAT)在这里增加了什么?它对动态服务图进行建模以捕捉跨服务依赖,帮助发现由微服务交互方式引发的异常,而不仅仅是个别日志行的问题。
异常到底是怎么打分的?混合集成将 Autoencoder 重构误差与 IsolationForest 和基于 GMM 的动态阈值相结合,产出一个统一的概率化异常分数。
我怎么知道一条日志为什么被标记为异常?该框架在融合特征上计算 SHAP 值,并在 Transformer 分支上使用 token 级梯度显著性,来解释是哪些 token 或特征推高了异常分数。
没有真实生产日志也能测试它吗?可以,它包含一个流式模拟器,可模拟微服务日志并支持可控的异常注入,适合端到端试用整条流水线。
Creator
chuansirrr
Size
<0.1 MB
Stars
979
Updated
CommitOct 21
Age
11mo
Commits · 90 Days