Skip to content

Decision: Audit Trail Strategy ​

Context ​

Multiple requirements in the system administration domain reference the need for audit trails, but the implementation approach has not been decided. This affects:

  • User creation and modification tracking
  • Project and worksite management auditing
  • Compliance and regulatory requirements
  • System security and incident investigation

Decision Required ​

How should audit trails be implemented across the Digital Lock On platform and admin system?

Options ​

Option 1: Database-Level Audit Logging ​

Description: Use database triggers or built-in audit features to automatically log all changes

Pros & Cons

Pros:

  • Automatic logging of all data changes
  • Difficult to bypass or tamper with
  • Comprehensive coverage

Cons:

  • Database-dependent implementation
  • Can impact performance
  • Limited contextual information (user intent, business context)

Impact: Medium development effort, potential performance impact


Option 2: Application-Level Audit Service ​

Description: Implement audit logging at the application layer with a dedicated service

Pros & Cons

Pros:

  • Rich contextual information
  • Business logic can be included
  • Flexible implementation
  • Can capture user intent and business context

Cons:

  • Developers must remember to add audit calls
  • Can be bypassed if not implemented consistently
  • Additional development complexity

Impact: High development effort, good flexibility


Option 3: Event-Driven Audit System ​

Description: Use event sourcing or domain events to capture all significant business actions

Pros & Cons

Pros:

  • Natural fit with event-driven architecture
  • Rich business context
  • Can be used for other purposes (analytics, notifications)

Cons:

  • Significant architectural change
  • Complex implementation
  • Learning curve for team

Impact: High development effort, architectural change required


Option 4: Hybrid Approach ​

Description: Combine application-level logging for business actions with database-level logging for data integrity

Pros & Cons

Pros:

  • Best of both worlds
  • Comprehensive coverage
  • Rich context where needed

Cons:

  • Most complex to implement
  • Potential for duplicate logging
  • Higher maintenance overhead

Impact: High development effort, comprehensive coverage

Considerations ​

Technical Considerations
  • Integration with existing Clerk audit capabilities
  • Performance impact on user operations
  • Storage requirements for audit data
  • Query performance for audit reports
Business Considerations
  • Regulatory compliance requirements for KiwiRail
  • Incident investigation needs
  • User privacy considerations
  • Data retention policies
Legal/Compliance Considerations
  • Railway safety regulations
  • Data protection requirements
  • Audit retention periods
  • Access control for audit data
Timeline Considerations
  • MVP can potentially launch without comprehensive audit trails
  • Audit trails become more critical as system usage grows
  • Regulatory requirements may have specific timelines
Budget Considerations
  • Storage costs for audit data
  • Development time for implementation
  • Ongoing maintenance costs

Stakeholders ​

  • Decision Maker: Technical Lead, Product Owner
  • Consulted: Development Team, KiwiRail Compliance Team, Security Team
  • Informed: All development team members, business stakeholders

References ​

Next Steps ​

  • [ ] Research KiwiRail's audit and compliance requirements
  • [ ] Investigate Clerk's audit capabilities
  • [ ] Prototype simple audit logging approach
  • [ ] Stakeholder consultation with compliance team
  • [ ] Decision meeting scheduled for 2024-01-25

Note: This decision is referenced in multiple system administration requirements and should be resolved before implementation begins.

Internal use only