Skip to main content

What are you looking for?

Explore our services and discover how we can help you achieve your goals

Client Workspace

Audit logging design: what to record as security and compliance evidence

An audit log works as evidence when it records a fixed catalogue of security-relevant events, each with the same minimum fields, keeps every event class for as long as the strictest obligation requires, and cannot be changed by the people it records. Netbase treats that event catalogue and its retention table as part of the application design.

Book a solution review See the healthcare operations solution

By Netbase Delivery and Quality Desk · Reviewed by David (CEO) · Updated · 11 min read

star

This guide is for CTOs, tech leads and product owners who must answer an auditor, a customer security questionnaire or an incident review with "who did what, when, and with which result". For an outside review of an existing application, see application security assurance.

In this guide

Why are application logs not audit evidence?

Debug and performance logs exist to help engineers fix the application. They are sampled, rotated after days, change format with every release and often contain whatever a developer printed. An auditor cannot rely on them, because nobody decided in advance which events they must contain.

An audit log answers a different question: can you prove that a specific action happened, who performed it and whether it succeeded? The OWASP Logging Cheat Sheet separates security event logging from operational logging for this reason, and it warns that logging needed for compliance must not be possible to switch off.

Missing logs are a recognised weakness in their own right. The OWASP Top 10 2025 lists security logging and alerting failures as category A09, covering insufficient logging, sensitive data written to logs and log injection.

Which events belong in the audit event catalogue?

Start from the evidence questions an auditor, a customer or an incident responder will ask, then list the events that answer them. The catalogue below covers most business applications; add domain events (approvals, payments, clinical record views) where your sector requires them.

  • Authentication

    Typical triggers
    Sign-in success and failure, MFA challenge, lockout, password or MFA reset, session revoked
    Evidence question it answers
    Who got in, and were attempts blocked?
  • Authorization and roles

    Typical triggers
    Access denied, role granted or removed, permission change, API key issued or revoked
    Evidence question it answers
    Who could do what, and who changed it?
  • Sensitive data access

    Typical triggers
    Viewing, exporting, bulk download or search over regulated records
    Evidence question it answers
    Who saw or took personal or confidential data?
  • Record changes

    Typical triggers
    Create, update and delete of business records, with before and after references
    Evidence question it answers
    Who changed this record, and what was it before?
  • Configuration and secrets

    Typical triggers
    Security settings, integrations, feature flags, key and secret operations
    Evidence question it answers
    Who weakened or changed a control?
  • Administrative and support access

    Typical triggers
    Impersonation, support sessions, direct database or console access
    Evidence question it answers
    Did staff or a vendor act on customer data?
  • The audit log itself

    Typical triggers
    Search, export, retention change, failed writes
    Evidence question it answers
    Was the evidence read, changed or interrupted?

What fields should every audit record carry?

Use one schema for every event class so records from different services can be correlated without manual work. The OWASP Logging Vocabulary Cheat Sheet proposes standard event names, which keeps the catalogue readable for someone outside the team.

  • When: a UTC timestamp from a synchronised clock.
  • Who: a stable actor ID (not a display name), actor type (user, service, support staff) and tenant.
  • What: an event name from the catalogue and the action attempted.
  • On what: the object type and a stable object ID.
  • Result: success, failure or denied, with a reason code.
  • Where from: source IP or service, client type and a request or correlation ID.
  • Context: the role or permission used, and a reference to the change, approval or ticket where one exists.

What should never be written to an audit log?

Passwords, session tokens, API keys, full payment card numbers, encryption keys and raw request bodies never belong in an audit log. Record a reference or a hash instead of the sensitive value, and log the field name that changed rather than its content when the content is personal data.

How long should each class of audit log be kept?

Retention is set by obligations, not by storage cost. List every obligation that applies (contracts, sector rules, data protection law, your own security policy) and let the longest one set each tier. Data protection law then works in the other direction: personal data in logs must not be kept longer than the purpose needs.

Tier What it holds Who can access it When to use it
Searchable store Recent events of every class, indexed for investigation Security and on-call engineers, read-only Daily review, alerts and incident response
Write-once archive All audit events, compressed, immutable until expiry A small named group, every access logged Audits, disputes and late-discovered incidents
Scheduled deletion Events past the longest obligation, plus legal holds lifted Automated job, with its own audit record Data protection limits and storage control

Decision rule: write the retention period for each event class into the catalogue, name the obligation that sets it, and review the table when a new contract or market adds one. If two obligations conflict, keep the longer period for the event class and reduce the personal data inside it.

How do you build the audit log, step by step?

  1. Write the evidence questions

    Collect the questions auditors, customers and incident reviews have asked, and agree them with the security and compliance owner.

  2. Draft the catalogue

    Map each question to event classes and triggers, and give each row an owner and a retention period.

  3. Fix the schema

    Agree one record schema and event vocabulary, and publish it in the repository next to the code.

  4. Emit from one library

    Write audit events through one shared module, not ad hoc log lines, so fields and redaction are consistent.

  5. Separate the store

    Send events to a store the application can append to but cannot change or delete, with a separate write account.

  6. Protect integrity

    Use write-once storage or chained hashes, synchronise clocks, and alert when audit writes fail or stop.

  7. Test the triggers

    Add automated tests that perform each catalogued action and assert that the matching record appears with every field.

  8. Review and rehearse

    Review access-change and admin events on a fixed schedule, and rehearse answering one real evidence request end to end.

Roles and permission changes come from the access model, so build the catalogue together with the role design in our guide to internal app access and least privilege. Key and secret operations should land in the same evidence trail, as described in the key management guide for application teams.

When should you not build a separate audit store?

A separate audit pipeline is not always worth it. A small internal tool with a handful of users and no regulated data can often rely on the audit features of its identity provider, database and cloud platform, if those are switched on and retained.

Do not log everything "just in case" either. Every extra field is personal data to protect, and a log nobody reviews proves little.

Where AI fits

AI helps around audit logging, never as the record itself. A model can read the code and propose catalogue rows for actions that lack an audit event, summarise access-change and admin events for the owner's scheduled review, and draft the narrative for an evidence request from records that engineers have selected. Engineers decide what is logged and verify every summary against the records, and no AI tool receives secrets or unredacted personal data. Netbase works with the major commercial and open-source AI tools and models, chosen per project, under human control. AI agents add their own event class (prompt, model, policy version and approval), covered in the guide to the AI agent audit trail.

What delivery record exists, and what does not

Netbase's published security practices include secure code review and version control, TLS in transit and AES at rest, role-based access control, MFA for admin dashboards, vulnerability scanning and penetration testing, and disaster recovery. Security by design is part of how Netbase approaches delivery, and Netbase follows GDPR alignment for data privacy in Europe, HIPAA-aligned methodologies for healthcare data handling and CCPA compliance for clients with U.S. customer bases.

Netbase has delivered projects for clients in healthcare and other industries, including a healthcare operations platform for a client that is not named. Netbase also works as offshore development partner on a multi-tenant cloud ERP for a US client delivered as SaaS to small and mid-sized businesses, the kind of shared platform where tenant ID belongs in every audit record.

Netbase holds ISO 27001 certification and a SOC 2 Type II attestation for its own operations; neither certifies a client's application or its audit log. Delivery follows a six-step lifecycle with weekly reviews, where an open catalogue item is tracked. Netbase does not publish audit results, incident figures or a timeline for an audit logging project; this guide explains a method, not a case study.

Who should design the audit log, and how do you choose?

  • The application team, with a compliance owner. Fits most products: the team owns the catalogue, schema and tests; the compliance owner signs off the evidence questions and retention.
  • A central platform or security team. Fits companies with many applications that share one log pipeline and archive; each application team still owns its catalogue rows.
  • An outside review. Fits when an audit or a large customer is close and you need an independent check of coverage and retention; the secure development lifecycle guide shows where such checks sit.

Selection criteria: how many applications share the log pipeline, whether a contract or regulator names retention, and who answers evidence requests today. Most Netbase projects are delivered on fixed-price contracts, and a written event catalogue makes that scope easy to agree.

Limits of this guide

  • It does not give legal advice or name a retention period for any specific law; confirm periods with your compliance or legal owner.
  • It does not compare named log management or SIEM products.

Plan the next step with a Netbase consultant

Frequently asked questions

An application log helps engineers debug and may be sampled or rotated quickly. An audit log records a fixed catalogue of security-relevant events with stable fields, is kept for a defined period and is protected from change, so it can serve as evidence.

Log reads for regulated or sensitive records, exports and bulk searches, because those answer who saw the data. Routine reads of non-sensitive data usually add volume without evidence value, so leave them out unless an obligation requires them.

Keep each event class for the longest period that any applicable contract, sector rule or internal policy requires, then delete it on schedule. Write the period and the obligation behind it next to each row of the event catalogue.

They should not be able to. Write audit events through an account that can only append, store them in write-once storage or a hash chain, and log every access to the audit store itself.

Next step

If an auditor or customer asked tomorrow who changed a permission last month, and nobody could answer, send us a short description of your application and we will reply with a proposal for an audit event catalogue and retention review.

Application security assurance for web, SaaS and AI features Application security assurance for web, SaaS and AI features

Netbase provides application security testing for product and engineering leaders to find and fix vulnerabilities before release, including in AI features. We review code with AI-assisted triage, scan dependencies and test running applications, then rank findings and retest fixes. Netbase's own alignment with ISO 27001 and SOC 2 Type II covers Netbase's operations, never your application.

Learn More
line
Healthcare operations platform with AI: scheduling, patient flow and records workflows Healthcare operations platform with AI: scheduling, patient flow and records workflows

A healthcare operations platform is software for the operational side of clinics and hospitals: scheduling, patient flow from check-in to discharge, staff tasks and records paperwork, with AI drafting intake data and scheduling advice for staff to approve. Netbase builds it custom, reviews data handling per jurisdiction with your advisers, gives no compliance guarantee, and has delivered healthcare operations work.

Learn More
line

Work with Netbase remotely

Every Netbase engagement is delivered remotely, so clients in any country and any industry can work with us; Netbase has worked with clients in 80 countries. Contracts and invoices are issued by Netbase JSC, and payment is made by bank transfer to Netbase JSC's company account or PayPal Business. Talk to the CEO, Huy Nguyen (David), on WhatsApp or by email.

Contact Netbase

Discuss a project

Netbase JSC helps organizations design, build, modernize, and operate digital products and AI-enabled business systems.
Project enquiries

project@netbasejsc.com

WhatsApp

+84 937 869 689

Office address

91 Nguyen Chi Thanh, Dong Da, Hanoi, Vietnam

Get in touch

Tell us what you want to build, modernize, or operate.

Tell us what you want to build, modernize, or operate.

Contact Netbase