Built by Oussama Sahnoun β for the community π
100% free AI assistant that hunts threats in your logs like a senior SOC analyst

ThreatLens is an open-source AI-powered log analysis and threat hunting assistant built for SOC analysts and cybersecurity professionals. Upload your Windows Event Logs (.evtx) or Linux logs (.txt), ask questions in plain English, and get expert-level threat hunting answers in seconds β faster than any manual review.
Built on a fully free stack: Groq API for ultra-fast LLM inference, Ollama for local private embeddings, and PostgreSQL + pgvector for semantic search. No data leaves your machine.
πΉπ³ Built in Tunisia β 100% free stack, no international payment required
| Feature | Description |
|---|---|
| π Log ingestion | Windows EVTX and Linux TXT log support |
| π URL ingestion | Scrape and index any web page into the knowledge base |
| π§ RAG pipeline | Logs are chunked, embedded locally, and stored in pgvector |
| β‘ Groq LLM | Ultra-fast inference with LLaMA 3.3 70B via free Groq API |
| π Private embeddings | Fully local via Ollama β no data sent to the cloud |
| π¬ Conversational memory | Multi-turn chat with full history awareness |
| π 100% Free | Groq API + Ollama + Docker β zero cost |
| Format | Extensions | Status |
|---|---|---|
| Windows Event Log | .evtx |
β Supported |
| Plain text / Linux logs | .txt |
β Supported |
| JSON logs | .json |
π Roadmap |
| CSV logs | .csv |
π Roadmap |
| XML event logs | .xml |
π Roadmap |
User uploads log (EVTX / TXT) or pastes a URL
β
βΌ
Chunker (300 chars/chunk)
Safe for nomic-embed-text 512-token limit
β
βΌ
Ollama (nomic-embed-text) βββΊ pgvector (PostgreSQL)
β
βΌ
User asks a question
β
βΌ
Semantic search in pgvector
β
βΌ
Groq LLM β LLaMA 3.3 70B
β
βΌ
Expert threat hunting answer π―
| Component | Technology |
|---|---|
| UI | Streamlit |
| LLM | Groq API β llama-3.3-70b-versatile (free) |
| Embeddings | Ollama β nomic-embed-text (local, private) |
| Vector DB | PostgreSQL + pgvector (Docker) |
| RAG Framework | phidata |
| EVTX Parser | python-evtx |
- Python 3.10+
- Docker
- Ollama
- A free Groq API key β no credit card needed
git clone https://github.com/sahnoun11/threatlens.git
cd threatlensdocker run -d --name threatlens-db --restart always \
-e POSTGRES_DB=ai \
-e POSTGRES_USER=ai \
-e POSTGRES_PASSWORD=ai \
-p 5532:5432 ankane/pgvectorollama serve
ollama pull nomic-embed-textpython3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtexport GROQ_API_KEY="your_free_key_here"Or create a .env file:
GROQ_API_KEY=your_free_key_herestreamlit run app.pyOpen your browser at http://localhost:8501 π
threatlens/
βββ app.py # Streamlit UI + file readers + chunking logic
βββ assistant.py # AI brain β Groq + RAG + SOC analyst prompts
βββ requirements.txt # Python dependencies
βββ assets/ # Banner and media files
βββ LICENSE # MIT License
βββ README.md
streamlit>=1.35.0
phidata>=2.4.0
groq>=0.9.0
ollama>=0.2.0
pgvector>=0.2.5
psycopg[binary]>=3.1.0
sqlalchemy>=2.0.0
python-evtx>=0.7.4
evtx>=0.8.2
requests>=2.31.0
beautifulsoup4>=4.12.0
openai>=1.0.0
Don't have logs to test with? Here are great free resources:
Windows EVTX:
- EVTX-ATTACK-SAMPLES β real attack scenarios mapped to MITRE ATT&CK
- OTRF Security Datasets β simulated APT campaigns
- evtx-baseline β baseline vs anomaly EVTXs
Linux Logs (TXT):
From your own machine:
cp /var/log/auth.log ~/test_auth.txt
cp /var/log/syslog ~/test_syslog.txt
dmesg > ~/test_dmesg.txtOnce you upload a log file, try asking:
What failed login attempts are in this log?
Are there any signs of lateral movement?
Summarise all privilege escalation events.
List all unique source IPs and flag suspicious ones.
What happened between 2:00 AM and 3:00 AM?
Are there any indicators of compromise (IOCs)?
Contributions are welcome from the community! Feel free to open issues or pull requests for:
- New log format support (JSON, CSV, XML, Syslog)
- Better chunking strategies
- MITRE ATT&CK mapping
- Dashboard / visualisation features
- Bug fixes and improvements
MIT β see LICENSE for details.
π¨βπ» Built by Oussama Sahnoun
"Analyse faster. Hunt smarter. Stay ahead." π‘οΈ
β Star this repo if you find it useful!