analyze-nginx-logs

analyze-nginx-logs is a command for Claude Code from trumb/claude-nginx-hardening. It costs 21 tokens per session (1,339 once invoked), scanned A, original, MIT.

A command that examines nginx access logs—records of requests made to a web server—for attack patterns, automated scanners, and emerging threats. It sanitizes the data before analysis and leaves the active configuration unchanged.

In plain words
What is it for?
Use it to find suspicious requests, group attack patterns, identify scanner signatures, and prepare findings for security-rule review.
Why use it?
It helps turn large or rotated log files into reviewed security findings without directly changing server rules or exposing raw attacker-controlled text to the analysis.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 scripts/sanitizer.py --input outputs/<run-id>/parsed-logs.json --output outputs/<run-id>/sanitized-findings.json --log-source <detected-path>.

Part of the claude-nginx-hardening plugin — 1 skill, 8 commands, 3 agents shipped together

Good fit Use it to find suspicious requests, group attack patterns, identify scanner signatures, and prepare findings for security-rule review.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/trumb/claude-nginx-hardening
agentmods
npx agentmods add commands/trumb/claude-nginx-hardening/analyze-nginx-logs

Made for: Claude Code.

Or install claude-nginx-hardening, the plugin that ships this one along with the rest of its 1 skill, 8 commands, 3 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyze-nginx-logs

README.md
[![agentmods](https://agentmods.dev/badge/commands/trumb/claude-nginx-hardening/analyze-nginx-logs/github.svg)](https://agentmods.dev/commands/trumb/claude-nginx-hardening/analyze-nginx-logs)
Your own site
<a href="https://agentmods.dev/commands/trumb/claude-nginx-hardening/analyze-nginx-logs"><img src="https://agentmods.dev/badge/commands/trumb/claude-nginx-hardening/analyze-nginx-logs/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for analyze-nginx-logs

Your own site · 80×15
<a href="https://agentmods.dev/commands/trumb/claude-nginx-hardening/analyze-nginx-logs"><img src="https://agentmods.dev/badge/commands/trumb/claude-nginx-hardening/analyze-nginx-logs.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,339 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00021 $0.01339
Opus 5 $0.00010 $0.00669
Sonnet 5 $0.00004 $0.00268
Haiku 4.5 $0.00002 $0.00134

Measured 11d ago against content hash 5570f290b349, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

analyze-nginx-logs scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| `internal-only` | `go-http-client`, `python-requests`, `curl` UAs downgraded to **info** (common in microservice traffic); internal IP ranges excluded from scanner detection |
commands/analyze-nginx-logs.md · 124 lines

How it starts

The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context

  • Log files: !ls -la /var/log/nginx/*.log 2>/dev/null | head -10 || echo "no logs found"
  • Rotated logs: !ls /var/log/nginx/*.gz 2>/dev/null | wc -l compressed log files found
  • Current learnings: !wc -l < learnings/LEARNINGS.md 2>/dev/null || echo "0" lines
  • Profile: !echo "${NH_PROFILE:-auto-detect}"

Operating Mode

DEFAULT: R0 + R1 (Recommendation Mode) Log analysis NEVER writes active config. Findings are staged for review.

Read @skills/nginx-hardening/EXECUTION-POLICY.md for full policy.

Your Task

Analyze nginx access logs to discover new attack patterns, scanner signatures, and threats.

Pipeline

This command orchestrates the full security pipeline:

Step 1: Detect Logs Auto-detect at standard locations or use user-specified paths:

  • /var/log/nginx/access.log (and .1 through .14.gz)
  • /var/log/nginx/*-access.log variants
  • User-specified: /analyze-nginx-logs /path/to/access.log

Report what was found before proceeding.

Step 2: Parse (Layer 1) Dispatch the log-parser agent:

  • Read-only access to log files
  • Hex-encodes all attacker-controlled fields
  • Outputs structured JSON with aggregated counts
  • Save raw parser output to outputs/<run-id>/parsed-logs.json

Step 3: Sanitize (Layer 2) Run the deterministic sanitizer:

python3 scripts/sanitizer.py --input outputs/<run-id>/parsed-logs.json --output outputs/<run-id>/sanitized-findings.json --log-source <detected-path>

If sanitizer fails → stop analysis, report error (Failure Policy).

Step 4: Analyze (Layer 3) Dispatch config-auditor agent with:

  • sanitized-findings.json
  • Current nginx config (if available)
  • Current learnings and exceptions

Agent produces findings and proposed rules.

Step 5: Present Findings Show the user:

  • New attack patterns discovered (not already covered by existing rules)
  • New scanner signatures detected
  • Hit counts and severity assessments
  • Proposed blocking rules for each finding

Step 6: Interactive Review For each finding, the user can:

  • Accept — Stage the proposed rule for deployment
  • Reject — Discard the finding
  • Exception — Mark as intentionally allowed (creates exception file)
  • Accept All — Batch accept remaining findings
  • Reject All — Batch reject remaining findings

Read the full file on GitHub · 124 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 124 lines · 21 tokens per session scan A 5570f290b349

Subscribe to this mod's changes

analyze-nginx-logs is a command published in the GitHub repository trumb/claude-nginx-hardening (3 stars, last pushed 5mo ago), licensed MIT. It adds 21 tokens to every session and 1,339 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.