Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Monitor and log API requests with correlation IDs, performance metrics, and security audit trails. Use when auditing API requests and responses. Trigger with phrases like "log API requests", "add API logging", or "track API calls".
.claude/skills/jeremylongshore-logging-api-requests/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | 56% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-17 | ✗→✓ | ▲ Improved | -29% | 0% |
Implement structured API request logging with correlation IDs, performance timing, security audit trails, and PII redaction. Capture request/response metadata in JSON format suitable for aggregation in ELK Stack, Loki, or CloudWatch Logs, enabling debugging, performance analysis, and compliance auditing across distributed services.
X-Request-ID header)X-Request-ID) for each request if not provided by the caller, and propagate it to all downstream service calls and log entries within the request scope.info for successful requests, warn for 4xx client errors, error for 5xx server errors with stack traces, and debug for request/response bodies (development only).audit: true for separate indexing.See ${CLAUDE_SKILL_DIR}/references/implementation.md for the full implementation guide.
${CLAUDE_SKILL_DIR}/src/middleware/request-logger.js - Structured request/response logging middleware${CLAUDE_SKILL_DIR}/src/middleware/correlation-id.js - Correlation ID generation and propagation${CLAUDE_SKILL_DIR}/src/utils/pii-redactor.js - Field-level PII redaction with configurable patterns${CLAUDE_SKILL_DIR}/src/utils/audit-logger.js - Security audit event logger for sensitive operations${CLAUDE_SKILL_DIR}/src/config/logging.js - Log level, format, and output destination configuration${CLAUDE_SKILL_DIR}/tests/logging/ - Logging middleware tests including PII redaction verification| Error | Cause | Solution | |-------|-------|----------| | Log volume overwhelming storage | High-traffic endpoint logging full request/response bodies | Log bodies only for errors; sample successful request bodies at configurable rate (1%) | | PII leak in logs | New field added to API response containing personal data not covered by redaction rules | Maintain allowlist of loggable fields rather than blocklist; audit log output regularly | | Correlation ID missing | Upstream service does not propagate X-Request-ID header | Generate new correlation ID when header is absent; log warning about missing upstream propagation | | Log parsing failure | Log message contains unescaped characters breaking JSON structure | Use structured logging library that handles serialization; never concatenate user input into log strings | | Audit log gap | Async logging dropped events during high-load period | Use synchronous logging for audit events; implement write-ahead buffer for audit trail completeness |
Refer to ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error patterns.
Structured JSON log entry: {"timestamp":"2026-03-10T14:30:00Z","correlationId":"abc-123","method":"POST","path":"/api/users","status":201,"durationMs":45,"userId":"usr_456","audit":false} -- every field queryable in log aggregation.
Distributed tracing correlation: Propagate X-Request-ID from API gateway through 3 microservices, enabling a single Kibana query to show the complete request lifecycle across all services.
Compliance audit trail: Tag all data modification operations (POST, PUT, DELETE) with audit: true, capturing the authenticated user, modified resource ID, and change summary for SOC 2 compliance evidence.
See ${CLAUDE_SKILL_DIR}/references/examples.md for additional examples.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-06 | fail→fail | 22,280 | 26,166 | +17% | 1 | 1 | 0% | 2,918 | 4,780 | +64% | 0 | 0 | — |
case-01 | fail→fail | 44,484 | 16,034 | -64% | 1 | 1 | 0% | 8,286 | 1,585 | -81% | 0 | 0 | — |
case-02 | fail→fail | 42,916 | 16,330 | -62% | 1 | 1 | 0% | 7,842 | 1,548 | -80% | 0 | 0 | — |
case-03 | fail→fail | 43,711 | 53,229 | +22% | 1 | 1 | 0% | 8,256 | 9,462 | +15% | 0 | 0 | — |
case-04 | fail→fail | 26,061 | 36,959 | +42% | 1 | 1 | 0% | 4,056 | 7,889 | +95% | 0 | 0 | — |
case-05 | fail→fail | 20,140 | 18,072 | -10% | 1 | 1 | 0% | 2,606 | 3,788 | +45% | 0 | 0 | — |
case-07 | fail→fail | 21,518 | 21,601 | +0% | 1 | 1 | 0% | 3,181 | 4,338 | +36% | 0 | 0 | — |
case-08 | fail→pass | 19,397 | 15,988 | -18% | 1 | 1 | 0% | 2,498 | 3,900 | +56% | 0 | 0 | — |
case-09 | pass→pass | 24,111 | 30,173 | +25% | 1 | 1 | 0% | 2,805 | 4,463 | +59% | 0 | 0 | — |
case-10 | fail→pass | 24,142 | 17,900 | -26% | 1 | 1 | 0% | 3,717 | 3,800 | +2% | 0 | 0 | — |
case-11 | pass→pass | 16,901 | 23,702 | +40% | 1 | 1 | 0% | 2,430 | 4,347 | +79% | 0 | 0 | — |
case-12 | pass→pass | 18,322 | 24,018 | +31% | 1 | 1 | 0% | 2,046 | 4,632 | +126% | 0 | 0 | — |
case-13 | fail→pass | 16,152 | 8,767 | -46% | 1 | 1 | 0% | 1,760 | 1,869 | +6% | 0 | 0 | — |
case-14 | pass→pass | 25,532 | 22,795 | -11% | 1 | 1 | 0% | 2,824 | 4,348 | +54% | 0 | 0 | — |
case-15 | pass→pass | 20,466 | 14,645 | -28% | 1 | 1 | 0% | 2,830 | 3,737 | +32% | 0 | 0 | — |
case-16 | fail→pass | 17,044 | 6,424 | -62% | 1 | 1 | 0% | 2,013 | 2,140 | +6% | 0 | 0 | — |
case-17 | fail→pass | 16,227 | 7,906 | -51% | 1 | 1 | 0% | 2,280 | 1,624 | -29% | 0 | 0 | — |
case-18 | fail→pass | 15,891 | 12,993 | -18% | 1 | 1 | 0% | 2,922 | 2,666 | -9% | 0 | 0 | — |
case-19 | pass→pass | 18,455 | 25,952 | +41% | 1 | 1 | 0% | 3,088 | 4,404 | +43% | 0 | 0 | — |
case-20 | pass→pass | 15,114 | 19,426 | +29% | 1 | 1 | 0% | 2,817 | 3,960 | +41% | 0 | 0 | — |
case-21 | pass→pass | 17,508 | 19,457 | +11% | 1 | 1 | 0% | 2,469 | 4,110 | +66% | 0 | 0 | — |
case-22 | pass→pass | 27,873 | 35,797 | +28% | 1 | 1 | 0% | 3,854 | 6,180 | +60% | 0 | 0 | — |
case-23 | pass→pass | 12,665 | 19,069 | +51% | 1 | 1 | 0% | 1,558 | 3,831 | +146% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 21 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +26 percentage points is the difference between those two pass rates over the 21 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.