# Structured Logging Audit Gate

> Sistemde optimum maliyetli yapısal loglama, asenkron exception takibi ve temiz denetim izi (Audit Trail) kurallarını zorunlu tutan kapı.

- Skill: `gktuoktay/structured-logging-audit-gate` (Agent Skill)
- Install (CLI): `npx skillmds@latest add gktuoktay/structured-logging-audit-gate`
- Raw SKILL.md: https://api.skillmd.com/api/skills/gktuoktay/structured-logging-audit-gate/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: GktuOktay (https://skillmd.com/u/gktuoktay)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/gktuoktay/structured-logging-audit-gate

---


# Structured Logging & Audit Gate

CRITICAL RULE: When writing backend logic, controllers, or database layers, you MUST enforce the following logging and auditing principles:

1. **No Full Req/Res Payload Logging:** NEVER log full HTTP request or response bodies for successful (200 OK) requests due to storage and PII/GDPR costs. Log only Metadata (Method, Path, StatusCode, Duration, UserID). Exception logs can contain payloads if necessary.
2. **Triad Logging Separation:**
   - **Diagnostic/Exception Logs:** Must be logged asynchronously. Do not write these to the main OLTP database tables fighting for IOPS.
   - **Security/Audit Logs:** Must be immutable.
   - **User Activity Logs:** Do NOT write hardcoded localized strings (e.g., "Sipariş güncellendi"). Save an `ActionType` (e.g., "ORDER_UPDATED") and `JSON Metadata`. Let the frontend translate it.

