Small defensive log-review script that sends chunks of a local log file to an OpenAI model and prints the lines the model flags as suspicious.
This is intentionally a minimal experiment, not a SIEM, detector, or production incident-response system. It is useful as a readable baseline for AI-assisted triage workflows and prompt design.
Keywords: log analysis, security logs, AI-assisted triage, defensive security, OpenAI, Python.
- Review logs before sending them to any hosted model.
- Do not send secrets, personal data, customer data, credentials, or regulated records.
- Treat the output as analyst assistance, not a finding by itself.
- Validate suspicious lines manually.
- Python 3.10+
- OpenAI Python SDK
OPENAI_API_KEYOPENAI_MODEL
Install:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtOn Windows PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txtexport OPENAI_API_KEY="..."
export OPENAI_MODEL="your-model-name"
python aiLogger.py --logfile /path/to/logfile.logOn Windows PowerShell:
$env:OPENAI_API_KEY="..."
$env:OPENAI_MODEL="your-model-name"
python .\aiLogger.py --logfile .\sample.logThe script:
- reads non-empty log lines,
- batches them into small chunks,
- asks the model for suspicious line numbers,
- prints the original flagged lines for review.
- No structured parser yet.
- No redaction layer yet.
- No deterministic detection rules.
- No guarantee that the model catches the important line.
For production work, pair model-assisted review with deterministic parsing, local redaction, SIEM rules, and human verification.
This repo includes AGENTS.md for Codex, Claude Code, and other coding agents. Good next tasks include local redaction, synthetic sample logs, structured JSON output, deterministic prefilters, and local-model adapters.
MIT. See LICENSE.