Skip to content
Back to skills

Logging Observability

ASecurity

Designs .NET structured logs, traces, metrics, correlation, and telemetry redaction around operational questions. Use for service observability; do not use for runtime dump/counter investigations (use dotnet-diagnostics) or code correctness review.

  • 7 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 4, 2026
ai-agentsbackendsecurityperformance

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add k4ndev/claude-code-dotnet --skill logging-observability --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Logging Observability?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Logging Observability
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/k4ndev-logging-observability/badge)](https://www.skillsdirectory.com/skills/k4ndev-logging-observability)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: logging-observability
description: Designs .NET structured logs, traces, metrics, correlation, and telemetry redaction around operational questions. Use for service observability; do not use for runtime dump/counter investigations (use dotnet-diagnostics) or code correctness review.
---

# Logging and Observability

## Purpose
Make production behavior diagnosable with useful, privacy-safe telemetry at an operationally sustainable cost.

## Scope
`ILogger`, structured logging, scopes, distributed tracing, metrics, OpenTelemetry instrumentation, correlation, redaction, retention, and alert signals.

## When to use
- A service lacks actionable logs/metrics/traces or loses context across HTTP/messaging.
- User asks how to instrument or safely diagnose an operational question.

## Do not use for
- Collecting process dumps/counters/traces to solve a live incident: use `dotnet-diagnostics`.
- Broker processing reliability: use `messaging-patterns`.
- Audit/security analysis of sensitive data flow: coordinate `security-audit`.

## Required context
Identify the question operators need to answer, deployment/logging backend, sampling/retention, privacy policy, service boundaries, existing `Activity`/metrics, and volume/cost constraints.

## Workflow
1. Define a specific question (e.g. which dependency causes checkout latency) before adding telemetry.
2. Use structured templates and stable event names; keep values as properties instead of interpolating them into the message.
3. Use appropriate levels and log once where failures are classified/handled; avoid catch-log-rethrow at every layer.
4. Propagate trace/correlation context across HTTP and message boundaries; prefer OpenTelemetry-compatible instrumentation where supported.
5. Keep metric labels bounded (route template, outcome class); never label by user ID, request ID, URL, or arbitrary exception text.
6. Redact credentials, tokens, connection strings, payment data, and unnecessary PII; check logs, baggage, exceptions, and test fixtures.
7. Estimate event volume, sampling, retention, access control, and alert thresholds; verify telemetry with a test/exporter or local trace.

## Decision rules
- Logs describe discrete events; metrics are aggregatable bounded series; traces connect causal work. Do not substitute one blindly for another.
- Cancellation is usually not an application error; avoid error-level noise for expected request cancellation.
- Add instrumentation only when it answers a named question or supports a defined SLO/security audit.

## Expected output format
Show the operational question, event/metric/span design, privacy/cardinality rules, code sample, verification method, and cost/retention assumptions.

## Common mistakes
- Interpolated/unstructured logs, secrets in scopes, high-cardinality labels, duplicate exception logging, or claiming OpenTelemetry is automatically configured by adding a package.

## Edge cases
- Sampling may remove spans needed for rare errors; use appropriate tail/head sampling and error tagging strategy.
- User-controlled baggage can leak data and inflate telemetry; validate propagation and size.
- Log message template properties are not automatically redacted by every provider; verify sink configuration.

## Examples
See [observability examples](examples.md) for stable structured events and bounded metric labels.

## Test scenarios
- Positive: “Correlate an HTTP request with an outbox message without putting user IDs in metric labels.”
- Negative: “A process has a 2 GB managed heap; capture a dump” routes to `dotnet-diagnostics`.
- Boundary: security audit finds a token in logs; `security-audit` owns risk assessment and this skill recommends safe instrumentation/redaction.

## Related skills
`dotnet-diagnostics`, `security-audit`, `messaging-patterns`, `aspnetcore-patterns`, `performance-review`.

Files in this skill

  • SKILL.md3.8 KB
  • examples.md781 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.