A Wazuh SIEM pipeline that ranks alerts by urgency instead of just raising them. A custom correlation rule catches the brute-force attack that worked, and an LLM triage agent puts it at the top of the queue.
A SIEM that only detects things buries analysts. One SSH brute-force run against a lab VM produces hundreds of level-5 failure events, several stock "brute-force" composites, and somewhere in that noise one login that actually succeeded. Static rule levels can't tell "an attack is happening" apart from "an attack just worked, so act now".
LogSentinel addresses this in two layers:
- Detect the compromise, not just the attempt. A custom Wazuh rule links the failure burst and the successful login into one level-12 alert.
- Prioritise. An AI agent reads each notable alert, assigns a criticality and a 0–100 score with a one-line rationale, and writes that verdict back onto the alert so the dashboard can sort by it.
The lab is three VMs on an isolated host-only network (192.168.100.0/24). Each VM also has a NAT adapter, used only for package updates. All management is over SSH with key-only login.
| VM | IP | Role |
|---|---|---|
rhel-wazuh (RHEL 9.6, 6 GB) |
192.168.100.10 |
Wazuh manager + indexer + dashboard in Docker Compose (single-node), plus the AI triage agent |
monitored (RHEL, 2 GB) |
192.168.100.20 |
Target running nginx, Postfix and sshd, monitored by the Wazuh agent |
kali (2 GB) |
192.168.100.30 |
Attacker running Hydra SSH brute force against a deliberately weak demo account |
The dashboard is served over TLS by a private LogSentinel CA. The AI agent talks to the indexer API over verified TLS (no -k / verify=False).
The rule fires when an account successfully logs in after 5 or more failed attempts within 60 seconds (MITRE T1110.001, level 12).
<group name="local,syslog,sshd,">
<rule id="100100" level="12" frequency="5" timeframe="60">
<if_sid>5715,5501</if_sid> <!-- SSH auth success OR PAM session opened -->
<if_matched_sid>5760</if_matched_sid> <!-- ...preceded by 5+ sshd auth failures -->
<same_user /> <!-- ...against the same account -->
<description>SSH login succeeded for $(dstuser) after 5+ failed attempts in 60s - possible brute-force compromise</description>
<mitre><id>T1110.001</id></mitre>
<group>authentication_success,brute_force,</group>
</rule>
</group>The full, commented version is in rules/local_rules.xml.
The textbook version of this rule (including Wazuh's own documentation example) keys on 5715 (sshd: authentication success) and same_source_ip. On RHEL 9.6 + OpenSSH 9.9 it never fired. Across 338 failure events there was not a single 5715 for the victim account.
The cause is a log-transport asymmetry in OpenSSH 9.8+, where the daemon was split into sshd and sshd-session:
| Event | Destination | Seen by the Wazuh journald collector? |
|---|---|---|
Failed password |
journald | ✅ → rule 5760 |
Accepted password |
syslog(LOG_AUTHPRIV) → rsyslog → /var/log/secure only |
❌ → no 5715 |
pam_unix(sshd:session): session opened |
journald | ✅ → rule 5501 |
So the rule keys on 5501 (keeping 5715 for portability) and correlates by user instead of source IP. That is arguably the better detection anyway, because a compromise is defined by which account fell, not by the attacker's current IP. The full investigation is in the Phase 4 runbook.
agent/ai_agent.py is a ~190-line Python service that turns static rule levels into a triage decision.
┌────────────┐ 1. poll every 15 s ┌──────────────┐ 2. alert summary ┌───────────────────┐
│ Wazuh │ ──────────────────────▶ │ ai_agent │ ───────────────────▶ │ Groq LLM │
│ indexer │ level ≥ 7, unscored │ (Python) │ (rule, MITRE, │ openai/gpt-oss-120b│
│ (OpenSearch│ │ │ user, raw log) │ strict JSON out │
│ :9200) │ ◀────────────────────── │ │ ◀─────────────────── │ │
└────────────┘ 4. _update ai.* block └──────────────┘ 3. verdict └───────────────────┘
│ {criticality, score, reasoning}
▼
Wazuh dashboard: "AI Triage" view sorted by ai.score
- Poll. Query
wazuh-alerts-*for alerts withrule.level ≥ MIN_LEVEL(default 7) that have noai.scored_atyet. This keeps the agent idempotent with no cursor file. - Score. Send a compact summary of each alert (rule, level, MITRE ID, groups, target user, source IP, raw log) to Groq with a SOC-analyst system prompt and JSON-mode output.
- Validate. Coerce the response into a fixed schema:
criticality ∈ {critical, high, medium, low, info}, integerscorefrom 0 to 100, andreasoningof at most 160 characters. This keeps the OpenSearch mapping stable. - Write back.
_updatethe original alert document with anai.*block (criticality,score,reasoning,model,scored_at) so the verdict is searchable and filterable in the Wazuh dashboard.
Resilience. If Groq returns an error or is unreachable, the agent logs a warning and leaves the alert unscored to retry later; nothing crashes. With --degraded it switches to a severity heuristic that needs no LLM, so 100100 is still flagged critical when offline.
The agent doesn't just repeat the Wazuh level. In one live run it ranked related alerts from the same attack differently:
Results from a single live Hydra run (kali → backupsvc@monitored) with the agent polling:
| Rule | What it means | Wazuh level | AI verdict |
|---|---|---|---|
2502 |
Stock composite: "user missed the password more than one time" | 10 | low · 30 ("multiple failures, no success") |
5763 |
sshd brute-force attempt | 10 | high · 80 ("brute force in progress, no successful login yet") |
40112 |
Stock: authentication success after multiple failures | 12 | critical · 95 |
100100 |
Custom: SSH login after a 5+ failure burst for the same user | 12 | critical · 95 ("likely compromise") |
The level-10 2502 composite, which a static view would rank near the top, is correctly demoted to low. The two alerts that mean an account fell are promoted to critical.
AI verdict written onto the 100100 alert |
"AI Triage" dashboard |
|---|---|
![]() |
![]() |
| Tactic | Technique | Where it's detected |
|---|---|---|
| TA0006 Credential Access | T1110.001 Brute Force: Password Guessing | 5760 per attempt, 2502 / 5763 burst composites |
| TA0006 Credential Access → TA0001 Initial Access | T1078 Valid Accounts (the guessed credential is used to log in) | 100100 (custom) and 40112 |
LogSentinel/
├── README.md
├── LICENSE
├── rules/
│ └── local_rules.xml # custom rule 100100 (commented)
├── agent/
│ ├── ai_agent.py # AI triage agent (Groq + degraded fallback)
│ ├── requirements.txt
│ └── .env.example # GROQ_API_KEY, INDEXER_PASSWORD, GROQ_MODEL
├── docs/
│ ├── architecture.html / .png # lab architecture diagram (the HTML is in French)
│ ├── demo-thumbnail.png
│ └── runbooks/ # phase-by-phase build runbooks, written during the live build
└── screenshots/
| Runbook | Covers |
|---|---|
| Build plan | Phase checklist |
| Phase 0: setup | VMware, host-only network, 3 VMs, SSH key-only hardening |
| Phase 1: Wazuh | Wazuh 4.14.6 single-node Docker stack, credential rotation |
| Phase 2b: dashboard TLS | Private CA, dashboard certificate |
| Phase 3: attack traffic | Victim account, Hydra, reading the real rule IDs |
| Phase 4: custom rule | Rule 100100 and the 5715/5501 investigation |
| Phase 5: AI agent | Verified-TLS indexer access, ai.* mapping, agent, dashboard, degraded mode |
- A running Wazuh 4.x stack (single-node wazuh-docker works) with at least one agent sending SSH auth logs
- Python 3.9+ on a host that can reach the indexer on
:9200 - A Groq API key (console.groq.com, free tier is enough). This is optional in
--degradedmode.
# Append the <group> block from rules/local_rules.xml to the manager's
# /var/ossec/etc/rules/local_rules.xml (exact heredoc in Phase 4 §3a), then:
docker exec single-node-wazuh.manager-1 /var/ossec/bin/wazuh-analysisd -t # syntax gate
docker restart single-node-wazuh.manager-1Copy the Wazuh root-ca.pem to the agent host and map wazuh.indexer to the indexer's IP so the TLS SAN matches. Then declare the ai.* mapping once. Phase 5 §3 and §5 have the exact commands.
cd agent
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
export INDEXER_PASSWORD='...' # indexer user password
export GROQ_API_KEY='...' # your own Groq key
export GROQ_MODEL='openai/gpt-oss-120b' # optional, this is the default
python ai_agent.py --once # score the current backlog once
python ai_agent.py # continuous: poll every 15 s
python ai_agent.py --degraded # no LLM: severity heuristic only| Variable | Default | Purpose |
|---|---|---|
INDEXER_URL |
https://wazuh.indexer:9200 |
Indexer API |
INDEXER_USER / INDEXER_PASSWORD |
admin / (required) |
Indexer credentials |
INDEXER_CA |
~/logsentinel-ai/root-ca.pem |
CA used to verify the indexer certificate |
GROQ_API_KEY |
(required unless --degraded) |
Groq API key |
GROQ_MODEL |
openai/gpt-oss-120b |
Groq model ID |
MIN_LEVEL |
7 |
Minimum Wazuh rule level to score |
LOOKBACK |
30m |
Time window to scan |
POLL_SECONDS |
15 |
Poll interval |
- No secrets in this repo. Every credential in the runbooks has been replaced with a placeholder (
<your-admin-password>,<your-indexer-password>,<your-groq-api-key>,<victim-password>). The agent reads secrets only from environment variables. - Bring your own key. Copy
agent/.env.example, fill it in locally, and never commit it..gitignoreblocks.env,*.key,*.pem, SSH keys andinternal_users.yml. - Lab only. The victim account, its weak password and the Hydra wordlist exist only to generate realistic attack telemetry on an isolated host-only network. Don't reproduce them on a reachable host.
- Least privilege. The demo uses the indexer
adminuser for simplicity. Phase 5 Appendix A describes a dedicated user restricted towazuh-alerts-*.
Oussama Hamada, @oussema-007 Built with Aladine Fadhli as the SSIRF module project at TEK-UP (class CII-5-J-SSIRF-D, 2026–2027).
Released under the MIT License.



