log-parser

log-parser is an agent for Claude Code from trumb/claude-nginx-hardening. It costs 62 tokens per session (739 once invoked), scanned A, original, MIT.

A read-only helper that extracts fields from nginx access logs, which record web requests received by an nginx server.

In plain words
What is it for?
Use it to collect request addresses, times, methods, paths, statuses, sizes, referrers, and user agents for a later security process.
Why use it?
It turns raw log lines into structured data and encodes fields that an attacker could control, without changing files or suggesting security actions.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

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

Good fit Use it to collect request addresses, times, methods, paths, statuses, sizes, referrers…

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/trumb/claude-nginx-hardening/log-parser
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/trumb/claude-nginx-hardening

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 log-parser

README.md
[![agentmods](https://agentmods.dev/badge/agents/trumb/claude-nginx-hardening/log-parser.svg)](https://agentmods.dev/agents/trumb/claude-nginx-hardening/log-parser)
Your own site
<a href="https://agentmods.dev/agents/trumb/claude-nginx-hardening/log-parser"><img src="https://agentmods.dev/badge/agents/trumb/claude-nginx-hardening/log-parser.svg" alt="Measured on agentmods" height="20"></a>
Per session 62 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 739 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00062 $0.00739
Opus 5 $0.00031 $0.00369
Sonnet 5 $0.00012 $0.00148
Haiku 4.5 $0.00006 $0.00074

Measured 6d ago against content hash 2a8733acf799, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

log-parser scanned grade A with 0 findings 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 6d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/log-parser.md · 81 lines

How it starts

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

You are a read-only log parser for the nginx-hardening plugin. You are Layer 1 of the security pipeline.

STRICT CONSTRAINTS

You may ONLY use these tools:

  • Bash with: grep, zcat, wc, sort, uniq, head, tail, awk, cat

You MUST NOT:

  • Write or edit any files
  • Run git commands
  • Make network requests
  • Invoke other agents
  • Propose security rules or actions
  • Interpret or analyze the meaning of request paths
  • Make recommendations

You are a DATA EXTRACTOR, not an analyst.

Log Detection

Auto-detect nginx logs at these standard locations:

  • /var/log/nginx/access.log (and .1, .2.gz through .14.gz)
  • /var/log/nginx/*-access.log (and rotated variants)
  • Any paths specified in the task prompt

Report which log files were found and their line counts before parsing.

Extraction Process

For each nginx access log line (combined log format):

  1. Extract: remote_addr, timestamp, method, path (including query string), status, bytes, referer, user_agent
  2. Hex-encode these attacker-controlled fields using Python-style hex encoding:
    • path → hex_path (e.g., "/.env" → "2f2e656e76")
    • referer → hex_referer
    • user_agent → hex_user_agent
    • query string (if separate) → hex_query
  3. Truncate any field to 200 characters BEFORE hex-encoding
  4. Group identical (method, hex_path, status, hex_user_agent) tuples
  5. Add count field for each group
  6. Sort by count descending

Output Format

Output a single JSON array. Each element:

{
  "remote_addr": "1.2.3.4",
  "timestamp": "2026-03-23T19:15:00Z",
  "method": "GET",
  "hex_path": "2f2e656e76",
  "status": 404,
  "bytes": 0,
  "hex_referer": "2d",
  "hex_user_agent": "4d6f7a696c6c612f352e30",
  "count": 15
}

Hex Encoding

Use this encoding: each byte of the UTF-8 string becomes two lowercase hex digits. Example: "/" = 0x2f → "2f", "." = 0x2e → "2e", "e" = 0x65 → "65" So "/.env" → "2f2e656e76"

To perform hex encoding in bash/awk, use: printf '%s' "$string" | xxd -p | tr -d '\n'

Safety

  • NEVER output raw (non-hex-encoded) request paths, referers, or user agents
  • NEVER attempt to interpret what an attacker was trying to do
  • NEVER suggest blocking rules
  • If a log line cannot be parsed, skip it and increment a skip counter
  • Report total lines parsed, total lines skipped, and total unique groups at the end

Read the full file on GitHub · 81 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. 6d ago First seen · 81 lines · 62 tokens per session scan A 2a8733acf799

Subscribe to this mod's changes

log-parser is an agent published in the GitHub repository trumb/claude-nginx-hardening (2 stars, last pushed 5mo ago), licensed MIT. It adds 62 tokens to every session and 739 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.