Audit logging

From lilinji/GeneTind-Life-Skills · View interactive version

Audit logging is an AI agent skill from the GitHub repository lilinji/GeneTind-Life-Skills. Define what and how to log for medical devices: security/safety events, integrity, protection, and retention of logs for compliance and forensics.

How to use this skill

Skill file

Audit Logging

Purpose

Define what and how to log for medical devices: security/safety events, integrity, protection, and retention of logs for compliance and forensics.

When to Apply

Requirements (testable)

  1. Scope: Log authentication events, config changes, safety actions, updates, anomalies, and PHI access (without logging PHI content). Rationale: accountability.
  2. Integrity: Protect logs against tampering (hash chain/MAC, restricted access); no user-level editing. Rationale: trustworthiness.
  3. Time Sync: Ensure timestamps are reliable (NTP/PTP or hardware RTC); detect drift. Rationale: ordering and forensics.
  4. Minimal PHI: Do not store PHI unless necessary; if stored, encrypt and minimize. Rationale: privacy.
  5. Retention: Define retention and secure storage/backup; support export for investigations. Rationale: compliance and availability.
  6. Performance: Logging must not jeopardize safety/timing; use buffering with backpressure limits. Rationale: safety.

Recommended Practices

Patterns

Hash-chained log entry:

// REQ-AUD-INT-01; TEST-AUD-04
typedef struct {
    uint8_t prev_hash[32];
    audit_event_t ev;
    uint8_t hash[32];
} audit_record_t;

Structured log example:

evt=auth_fail user=clinician1 code=LOCKOUT ts=2026-01-04T12:00:00Z

Anti-Patterns (risks)

Verification Checklist

Traceability

References

Changelog

Audit History

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.