Back to Blog

Understanding Audit Logs: What It Is & How To Build One

Pranav Shikarpur
Pranav Shikarpur

Audit logs are a critical component of enterprise systems, providing a detailed record of activities within an information system. They serve as the backbone for security monitoring, compliance, and operational analysis, making them indispensable for most organizations. For engineers, managing complex enterprise systems, understanding and effectively managing audit logs is crucial to maintain security of these systems. This guide will explore what audit logs are, their key components, use cases, challenges they present, and how to evaluate an audit log solution. You will also learn how to get started building an audit log for free with Pangea, a security APIs platform that offers tamperproof audit logs with upto 10-year audit log retention.

What is an Audit Log?

Audit logs are records of all critical user and system actions in a given tech stack. They capture detailed information about actions performed within the system, including:

  • who performed the action (actor)

  • what was affected (action)

  • when the action occurred (timestamp)

  • nature of the action itself (target).

Since audit logs are meant to track critical user actions or system changes ideally it must remain tamperproof and federated as it is a single source of truth in the event of a breach.

Unlike application logs, which track events at the application level, or system logs, which monitor server events, audit logs specifically focus on critical user actions and system changes​.

Note: the word audit trails and audit logs are used interchangeably, but the difference is that an audit trail is a collection of multiple audit logs.

Audit Logs vs Application Logs

Application logs track all things logging (such as HTTP request logs, error logs, system logs) - some with valuable information and others with verbose jargon. Audit log data, on the other hand, track critical user actions or system changes (such as user account deletion, file changes on a server, dropping a SQL table, etc).

Furthermore, application logs are particularly useful in development and staging environments when developers try to debug errors or inspect API calls. While application logs have a role in every environment, they aren’t intended to give us critical information of who did what when and to whom in our app. On the contrary, the primary purpose of an audit log is to ensure accountability and observability across components in an information system. By maintaining a comprehensive trail of system activities, audit logs help organizations detect and respond to unauthorized access, data breaches and other security incidents.

Most importantly, audit logs play a crucial role in meeting compliance requirements (ex- GDPR compliance, HIPAA compliance, PCI DSS, SOC2, etc), serving as a tamper proof trail of evidence that an organization adheres to regulatory requirements.

Audit Log Best Practices

Immutability

One of the most important characteristics of audit logs is cryptographically verifiable immutability. Once an audit log entry is recorded, it should not be altered or deleted. This ensures the integrity of the logs, making them a reliable source of truth during investigations, audits, and legal proceedings.

Retention-periods

Depending on regulatory requirements, organizations are required to keep audit log retention periods anywhere from 1 - 7 years. In particular:

  • HIPAA audit logs - 6 years

  • PCI DSS audit logs - 1 year

  • ISO27001 audit logs - 3 years

  • NIST 800-53 - 3 years

  • SOX audit logs - 7 years (Source)

Federated Logging

Unlike application logging, where logs can exist for each micro-service or application; due to the sensitive and critical nature of audit logs, ensuring a centralized log of audit events is necessary. A consolidated audit trail ensures traceability of logs without log sprawl.

For a more in-depth understanding on Audit Log best practices to remain secure by design, read this article.

What types of actions do audit logs record?

Audit logs can record a vast array of information, but here are some key use-cases of events / actions you should store in an audit log:

  • User Activity and System Events: This includes actions taken by users, such as authentication, user signups, accessing, modifying, or deleting data, as well as system-level events like software installations, updates, and configuration changes.

  • Data Access and Modifications: Audit logs track who accessed specific data, what changes were made, and whether any data was deleted or transferred.

  • Transaction Histories and Security Incidents: They also keep a historical record of transactions within the system, including financial transactions, and log any security incidents such as failed login attempts or suspicious activities.

  • Administrative and Configuration Changes: Changes made to system settings, user permissions, and other administrative actions are also captured in audit logs​

Use Cases for Audit Logs

Audit logs are essential for several critical functions within enterprise systems:

  • Regulatory Compliance: Many industries, such as healthcare and finance, require organizations to maintain detailed audit logs as part of regulatory compliance (e.g., HIPAA, GDPR). These logs provide evidence that the organization is adhering to required security and privacy standards.

  • Security Monitoring and Incident Response: Audit logs are vital for monitoring system activities in real-time and responding to security incidents. They allow security teams to detect unauthorized access, suspicious activity, investigate breaches, and take corrective actions promptly.

  • IT Forensics and Legal Evidence: In the event of a security breaches or legal dispute, audit logs serve as crucial evidence. They provide a detailed trail of events, helping investigators understand what happened, when it happened, and who was responsible.

Challenges with Audit Logs

While audit logs are invaluable, managing them effectively can be challenging:

  • Data Volume and Storage Costs: The sheer volume of data generated by audit logs can be overwhelming. Storing and managing these logs for years requires significant resources, both in terms of storage capacity and cost.

  • Correlating Logs Across Different Systems: In complex enterprise environments, audit logs may be generated by multiple systems and applications. Consolidating these logs to create a cohesive view of system activities can be challenging, especially when dealing with different log formats and protocols. Additionally, creating multiple search indices and joins over these different log sources can be an expensive solution. To combat this challenge, audit logs should be collected in a federated / centralized manner.

  • Maintaining Log Integrity at Scale: Building a cryptographically tamperproof audit log system takes a significant amount of resources both in terms of engineering as well as cost.

  • Access Control: Teams must have control over employee access to sensitive audit logs. While not all information should be audit logged, some information that should be logged such as user PII shouldn’t be accessible to every member of an organization. Thus enabling redaction or format preserving encryption gives you the ability to ensure secure access control with providing enough observability in the audit logs.

Evaluating an Audit Log System

While evaluating audit logs, there is an age-old question of “build vs buy.” While there are advantages to each one, there are significant downsides of building audit logs in house. The cost in terms of engineering teams and resources is very significant. As Zane Silver, head of engineering at Codex Health, noted “By our quick calculations we figured it would take months to a year to build and then years of overhead to maintain.”

Thus, while evaluating an audit log solution you should ask yourself 3 questions:

  • Is it tamperproof / immutable?

  • Does the audit log need to retain data for a year or more?

  • Is it a federated / consolidated audit trail?

Getting Started with Audit Logs

Pangea’s Audit Log service meets all these 3 criterias being:

  • Tamperproof using a cryptographically secure system known as Merkle trees

  • Retains up to 10 years of audit logs while remaining affordable for most organizations

  • Centralized in one platform

Additionally, Pangea Audit Log also supports custom schemas with templates that enable engineering teams to set up audit logs that meet regulatory requirements (HIPAA, GDPR, etc) in just a few clicks!

Pangea’s Audit Log service is used by a vast array of healthcare and financial organizations to meet regulatory requirements and protect their complex information systems. It’s free to start!

Step 1: Signup for an account on pangea.cloud

Head over to pangea.cloud and create an account for free. Then in the developer console, enable the “Secure Audit Log” service and grab the newly-created “Pangea Token” from the dashboard. Paste this token in your .env file.

Step 2: Setup an Audit Log schema

Continue with the default “Standard Audit Log” schema that contains basic fields to give you an understanding of how the audit log works. You can also choose from an array of general HIPAA, GDPR, PCI DSS, and other compliance templates.

Hit next and head over to the Audit log dashboard.

Pangea Audit Log Schema selection screen

Step 3: Create your first Audit Log Entry

On the left panel in the dashboard, click on Explore the API and you should be redirected to the audit log API docs. Here we’ll click the Load Sample button, add Hello World to the message field, and hit submit.

Once you see a successful API response, head back into the Audit Log dashboard and go to the View Logs tab on the left panel. Here you should see your newly created Audit Log. Additionally, you can also view details about tamperproof validation.

Conclusion

Audit logging is a foundational element of enterprise system security and compliance. By recording detailed information about critical user actions and system events, they provide the traceability and accountability needed to protect sensitive data and meet regulatory requirements. For senior engineers managing complex systems, understanding how to effectively manage audit logs is crucial to maintaining system security.

Pangea’s Audit Log APIs allows organizations to get secure and scalable audit logging setup in just a few minutes. If you are interested in trying it out, you can start here for free.

Get updates in your inbox and subscribe to our newsletter

background landmass

We were recognized by Gartner®!

Pangea is a Sample Vendor for Composable Security APIs in the 2024 App Sec Hype Cycle report