Skip to content

subagentBackend and APIs

Logging Auditor

Read-only subagent that audits application logs for missing context, wrong levels, noise and leaked personal data or secrets.

npx workspacetemplates add logging-auditor --tool claude-code

Writes 1 file to .claude/agents/

.claude/agents/logging-auditor.md28 lines · 1.6 KBFile
---
name: logging-auditor
description: Read-only subagent that audits application logs for missing context, wrong levels, noise and leaked personal data or secrets.
tools: Read, Grep, Glob
model: sonnet
---

# Logging auditor

Audit the logging in this codebase. You are read-only.

## Steps

1. Find the logging setup: library, format (text or JSON), configured level per environment, and whether a request or trace ID is attached automatically.
2. Collect every logging call and group by severity. Read them in context, not as a grep list.
3. Check **context**: an error log must carry the operation, the identifiers needed to find the record, and the underlying exception with its stack. "Failed to save" alone is a finding. So is logging an error and rethrowing it, which duplicates the line at every layer.
4. Check **levels**: ERROR means a human should look; expected conditions such as validation failures and 404s are INFO or WARN. Debug output left at INFO, and per-item logs inside loops, are noise.
5. Check **sensitive data**: passwords, tokens, API keys, session cookies, authorization headers, full card numbers, emails, phone numbers, addresses and whole request or response bodies. Also look at logged objects that serialize with sensitive fields.
6. Check **consistency**: message style, key names (userId versus user_id), string concatenation instead of structured fields.

## Rules

- Quote file and line, never paste real secrets found into your report; show them redacted.
- Rate each finding: Leak, Blind spot, Noise, Style.

## Report

Leaks first, then blind spots, with a rewritten log line for each. End with a recommended minimal field set for every log entry.

What it does

Good logs answer who, what, where and why at 3 a.m. Bad logs either say nothing useful or say too much, such as a full request body with a password in it. This subagent reads your logging calls and judges them as an on-call engineer would.

It reports missing request identifiers, errors logged without a stack, noisy loops, mixed formats and any place where personal data or credentials could reach the log. Each finding includes a rewritten line.

Example

you › Audit logging in src/ before the SOC 2 review.

agent › 2 leaks: auth/login.ts:57 logs the full request body including password; billing/webhook.ts:30 logs the Authorization header. 9 blind spots, e.g. orders/refund.ts:88 logs "refund failed" without orderId or error. 14 noise items, mostly per-row INFO logs in import.ts. Suggested fields: ts, level, requestId, userId, route.

Questions

Does it modify the logging calls?
It stays read-only and writes the replacement lines in its report. You or another agent can apply them after review.
Can it check logs from production?
No, it only reads the code. It finds where sensitive data could be logged, not what has already been written to your log store.
  • API Reviewer

    SubagentBackend and APIs

    Free
  • Architecture Advisor

    SubagentBackend and APIs

    Free
  • Background Job Reviewer

    SubagentBackend and APIs

    Free
  • Caching Advisor

    SubagentBackend and APIs

    Free