Logging and observability

From RedHatProductSecurity/prodsec-skills · View interactive version

Logging and observability is an AI agent skill from the GitHub repository RedHatProductSecurity/prodsec-skills. Enforce centralized structured logging and audit trails in MCP servers. Use when building, configuring, or reviewing MCP server logging, observability, or audit capabilities.

How to use this skill

Skill file

Logging and Observability for MCP Servers

Security Requirement

MCP servers MUST implement comprehensive, centralized, structured logging. This is vital for auditing, troubleshooting, and detecting security incidents.

Centralized and Structured Logging

| Requirement | Details |

|---|---|

| Format | JSON or other structured format (not unstructured text) |

| Destination | MCP servers must be capable of sending logs to a central system (e.g., OpenShift logging stack, ELK, Splunk) |

| Protocol | Standard log shipping (syslog, OTLP, Fluentd, or equivalent) |

| Configurable | Deployers must be able to configure the log destination |

Audit Trail Requirements

Logs MUST capture enough detail to reconstruct a security incident:

| Field | Purpose |

|---|---|

| User identity | Who performed the action (from token sub claim) |

| Tool name | Which tool was invoked |

| Parameters | What parameters were passed (with sensitive data scrubbed) |

| Timestamp | When the action occurred (ISO 8601, UTC) |

| Result | Success or failure, including error details |

| Source | Client IP, request ID, session ID |

Sensitive Data Scrubbing

Logs MUST scrub sensitive data before recording:

Example Audit Log Entry

{
  "timestamp": "2026-03-03T14:30:00Z",
  "event": "tool.invocation",
  "user": "user-123",
  "tool": "email.send",
  "parameters": {
    "to": "j***@example.com",
    "subject": "Meeting update"
  },
  "result": "success",
  "request_id": "req-abc-123",
  "source_ip": "10.0.1.42"
}

Implementation Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.