Maintaining trustworthy audit logs is critical for security investigations, regulatory compliance, and incident response. When log entries can be silently modified or deleted by an attacker who has gained system access, your entire audit trail becomes worthless. Tamper-evident logging ensures that any modification to historical log entries is immediately detectable through cryptographic verification.
This guide covers self-hosted solutions for building tamper-evident audit trails, from transparency log implementations to hash-chained logging systems that you can run entirely on your own infrastructure.
Why Self-Hosted Log Integrity Matters
Centralized logging services from cloud providers give you a convenient place to send your logs, but they come with inherent trust assumptions:
- Cloud provider access: Provider administrators or compromised credentials can potentially alter log data
- Data sovereignty: Regulations like GDPR, HIPAA, and SOC 2 often require audit data to remain under your direct control
- Single point of failure: If your logging provider goes down, you lose visibility into your systems during the outage
- Cost at scale: Continuous high-volume log ingestion to managed services becomes expensive quickly
Self-hosted tamper-evident logging gives you full control over your audit data while maintaining cryptographic guarantees that entries haven’t been altered after being written.
Understanding Tamper-Evident Logging
Tamper-evident logging uses cryptographic techniques to make unauthorized modifications detectable. The three primary approaches are:
| Approach | How It Works | Strengths | Weaknesses |
|---|---|---|---|
| Hash chaining | Each log entry includes a hash of the previous entry, forming an unbreakable chain | Simple to implement, fast verification | Single chain can become a bottleneck |
| Merkle trees | Entries are organized in a hash tree; any modification changes the root hash | Efficient verification of subsets, parallel writes | More complex implementation |
| Transparency logs | Append-only public logs with cryptographic proofs (e.g., Rekor/Sigstore) | Public verifiability, ecosystem integration | Requires more infrastructure |
Rekor: Sigstore’s Transparency Log
Rekor is the transparency log component of the Sigstore project. While primarily designed for software supply chain security, its append-only, cryptographically verifiable architecture makes it suitable for general-purpose tamper-evident logging.
Key Features
- Append-only ledger: Once an entry is written, it cannot be modified or deleted without detection
- Merkle tree proofs: Each entry gets an inclusion proof that can be verified independently
- Signed tree heads: Periodic signatures of the current tree state prevent rollback attacks
- RESTful API: Simple HTTP interface for writing and querying log entries
- Redis/MySQL backend: Flexible storage options for production deployments
Installation
The easiest way to run Rekor is via Docker Compose:
| |
Save this as docker-compose.yml and start the stack:
| |
Writing and Verifying Log Entries
Use the rekor-cli tool to interact with your transparency log:
| |
Programmatic Entry Creation
For automated log ingestion, use the REST API directly:
| |
Hash-Chained Audit Logs
For simpler use cases, hash-chained log files provide tamper evidence without the infrastructure overhead of a full transparency log server.
How Hash Chaining Works
Each log entry includes a cryptographic hash of the previous entry:
| |
If an attacker modifies Entry 1, the prev_hash in Entry 2 no longer matches, and the entire chain from that point forward becomes invalid.
Implementing Hash-Chained Logging in Python
| |
Deploying with Docker
| |
Linux Auditd with Integrity Verification
The Linux Audit subsystem (auditd) provides kernel-level auditing that can be combined with hash-chained verification for a robust self-hosted integrity solution.
Configuration
| |
Forwarding Audit Logs with Integrity
| |
Enterprise Compliance Considerations
When deploying tamper-evident logging for compliance, consider these requirements:
| Standard | Log Retention | Integrity Requirement | Access Control |
|---|---|---|---|
| SOC 2 | 1+ year | Tamper-evident, cryptographic | Role-based |
| HIPAA | 6 years | Immutable audit trail | Least privilege |
| PCI DSS | 1 year (90 days online) | File integrity monitoring | Segregated access |
| GDPR | As needed | Integrity and confidentiality | Documented processing |
| SOX | 7 years | Tamper-proof, auditable | Segregation of duties |
Best Practices for Compliance
- Separate logging infrastructure: Run your log integrity systems on separate hosts from the systems being audited
- Write-once storage: Use WORM (Write Once, Read Many) storage or append-only volumes where possible
- Regular chain verification: Schedule automated integrity checks of hash chains at least daily
- Off-site backup: Maintain encrypted copies of log data in a separate physical location
- Access logging: Log all access to the logging infrastructure itself, creating a meta-audit trail
Choosing the Right Approach
| Criteria | Rekor/Transparency Log | Hash-Chained Files | Auditd + Forwarding |
|---|---|---|---|
| Complexity | High | Low | Medium |
| Scalability | High (distributed) | Medium (single chain) | High (kernel-level) |
| Public verifiability | Yes | No | No |
| Regulatory acceptance | Emerging | Accepted | Widely accepted |
| Infrastructure needs | Redis + MySQL + Trillian | Local disk only | Kernel support |
| Best for | Supply chain, multi-org | Single-team audit logs | Linux system auditing |
For most self-hosted environments, a layered approach works best: use auditd for kernel-level system auditing, hash-chained logging for application-level events, and Rekor for software supply chain artifacts and critical security events.
For related reading, see our supply chain security guide with Cosign and Notation and the runtime security comparison with Falco, osquery, and auditd. If you’re building a broader security operations center, our SIEM comparison covers centralized log analysis platforms.
FAQ
What is tamper-evident logging and how does it differ from tamper-proof logging?
Tamper-evident logging makes unauthorized modifications detectable through cryptographic verification (hash chains, Merkle proofs), while tamper-proof logging aims to make modifications technically impossible. Tamper-evident is more practical for self-hosted environments because it provides strong detection guarantees without requiring specialized hardware or append-only storage. If someone modifies a log entry, the cryptographic proof breaks and the tampering is immediately visible.
Can an attacker still delete log entries in a hash-chained system?
Yes, an attacker with filesystem access can delete log entries. However, this deletion is itself detectable: the hash chain will show a gap (the prev_hash of the entry after the deletion point won’t match any existing entry). Combined with periodic chain verification and off-site backups, deletions become both detectable and recoverable. For stronger guarantees, consider combining hash chains with write-once storage or remote log forwarding.
Is Rekor suitable for high-volume application logging?
Rekor is optimized for software supply chain artifact logging rather than high-volume application telemetry. For application-level tamper-evident logging at scale, hash-chained file-based approaches or log forwarders with cryptographic signing (like Fluent Bit with TLS + hash verification) are more practical. Rekor excels at storing and verifying specific, high-value entries like deployment signatures, container image digests, and release attestations.
How often should I verify my log integrity chains?
For compliance-driven environments (SOC 2, HIPAA, PCI DSS), automated verification should run at least daily. For high-security environments, real-time verification of each new entry is recommended. The verification process is fast — a Python hash chain verifier can process 100,000 entries in under a second on modern hardware. Store verification results separately from the log files themselves to prevent an attacker from covering their tracks by modifying verification reports.
Do I need a transparency log like Rekor for basic compliance?
Not necessarily. Most compliance frameworks (SOC 2, HIPAA, PCI DSS) accept hash-chained or cryptographically signed log files as sufficient evidence of integrity. Transparency logs like Rekor provide an additional layer of public verifiability and are most valuable for software supply chain security, multi-organization audit scenarios, and environments where you need third-party-verifiable evidence. For single-organization compliance, a well-implemented hash-chained logging system with regular verification is typically sufficient.