<a id="best-practices-cloud-audit-logs"></a>

# Best Practices for Audit Logs on Confluent Cloud

Review the following security best practices for Confluent Cloud audit logs to ensure
you are reducing security risks and maximizing the value of your audit data.
For conceptual information, see [Audit Log Concepts on Confluent Cloud](cloud-audit-log-concepts.md#cloud-audit-logs). To set up audit log
access, see [Access and Consume Audit Logs on Confluent Cloud](configure.md#cloud-activate-audit-logs).

## Access control and security

### Grant permissions based on the principle of least privilege

Apply the
[principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege),
granting access to audit log data only as needed for intended purposes. To
consume audit log messages, users must have an API key specific to the audit
log cluster. Consider creating separate service accounts for different use
cases:

* **Security monitoring**: Read-only access for security information and event
  management (SIEM) integration
* **Compliance reporting**: Limited access for audit report generation
* **Operations monitoring**: Access for operational dashboards and alerting

### Rotate audit log API keys periodically

Rotate the active audit log API key regularly to reduce the risk of malicious
use. For details, see [Best Practices for Using API Keys on Confluent Cloud](../../security/authenticate/workload-identities/service-accounts/api-keys/best-practices-api-keys.md#api-keys-best-practices).

Implement a key rotation schedule that balances security with operational
stability:

* **High-security environments**: Monthly rotation
* **Standard environments**: Quarterly rotation
* **Always**: Immediate rotation if compromise is suspected

## Access Transparency

### Enable for compliance requirements

Enable Access Transparency to monitor Confluent personnel access to your
infrastructure, especially if you have strict compliance requirements. For
details, see [Access Transparency on Confluent Cloud](access-transparency-overview.md#access-transparency-overview).

* **DORA compliance**: Meet Digital Operational Resilience Act (DORA)
  requirements
* **Financial services**: Fulfill Financial Conduct Authority (FCA), Prudential
  Regulation Authority (PRA), Bundesanstalt für Finanzdienstleistungsaufsicht
  (BaFin), and Australian Prudential Regulation Authority (APRA) requirements
* **General compliance**: Support SOX, GDPR, and other frameworks

## Data retention and storage

### Retain data for auditing and compliance

By default, Confluent Cloud audit log records are retained in Confluent Cloud for seven days
on an independent Apache Kafka® cluster. These audit log records cannot be modified or
deleted and you cannot produce directly to the audit log topic.

For analysis purposes and to meet requirements for administrative, legal, audit,
compliance, or other operational purposes, you might need to retain audit log
data for longer than seven days. Consider retention requirements based on:

* **Regulatory compliance**: SOX (seven years), GDPR (varies), HIPAA (six years)
* **Industry standards**: PCI DSS (one year), ISO 27001 (varies)
* **Internal policies**: Security incident investigation, operational analysis

For details, see [Retain Audit Log Records on Confluent Cloud](retain-audit-logs.md#retain-audit-log-records).

### Replicate or export audit log data

You can replicate or archive Confluent Cloud audit log records to another Kafka cluster
or to an external system. For details, see [Retain Audit Log Records on Confluent Cloud](retain-audit-logs.md#retain-audit-log-records).

#### Audit log export strategies

* **Real-time streaming**: For immediate alerting and monitoring
* **Batch processing**: For compliance reporting and long-term analysis
* **Hybrid approach**: Real-time for critical events, batch for comprehensive
  analysis

### Consider storage and billing implications

Plan for additional storage and billing costs when you retain audit log
records beyond the default seven-day period.

#### Audit log storage cost optimization

* **Tiered storage**: Use hot storage for recent data, cold storage for archival
* **Data compression**: Implement compression for long-term storage
* **Selective retention**: Retain only necessary event types for extended periods

## Log analysis and monitoring

### Implement structured log analysis

Design your audit log analysis around key security and operational patterns:

#### Authentication monitoring

* Failed authentication attempts
* Unusual login patterns (time, location, frequency)
* Service account usage anomalies

#### Authorization tracking

* Permission escalation attempts
* Access to sensitive resources
* Cross-environment access patterns

#### Operational awareness

* Resource creation and deletion patterns
* Configuration changes
* Performance and availability impacts

### Set up automated alerting

Configure automated alerts for critical security events:

#### High-priority alerts

* Multiple failed authentication attempts
* Administrative privilege usage
* Resource deletion operations
* Unusual API key activity

#### Medium-priority alerts

* New resource creation outside business hours
* Cross-region resource access
* Schema Registry changes

#### Low-priority alerts

* Connector status changes
* Topic configuration modifications

## SIEM integration best practices

### Choose appropriate integration method

Select the integration approach that best fits your SIEM capabilities:

#### Real-time streaming

* Use for immediate threat detection
* Requires SIEM with Kafka consumer capability
* Higher resource usage but immediate visibility

#### Batch ingestion

* Use for compliance and historical analysis
* Lower resource impact
* Suitable for scheduled reporting

#### Hybrid approach

* Stream critical events in real-time
* Batch process remaining events
* Balances performance with coverage

### Optimize data formats for your SIEM

Transform audit log data to match the data format your SIEM expects:

* **Field mapping**: Map Confluent Cloud audit fields to SIEM schema
* **Normalization**: Standardize timestamp formats and field names
* **Enrichment**: Add context like user department, resource criticality
* **Filtering**: Exclude noise events to reduce SIEM load

## Performance and scalability

### Design for high-volume environments

Plan your audit log consumption for scale:

#### Consumer configuration

* Use consumer groups for parallel processing
* Tune batch sizes based on processing capacity
* Implement proper offset management

#### Processing optimization

* Use asynchronous processing where possible
* Implement backpressure handling
* Monitor consumer lag and processing times

#### Resource planning

* Size storage based on retention requirements
* Plan network bandwidth for real-time streaming
* Consider geographic distribution for global deployments

### Monitor audit log system health

Implement monitoring for your audit log infrastructure:

* **Consumer lag**: Track processing delays
* **Error rates**: Monitor parsing and processing failures
* **Storage utilization**: Track retention and archival storage
* **Network connectivity**: Monitor connection to audit log cluster

## Compliance and governance

### Map to compliance frameworks

Align your audit log strategy with relevant compliance requirements:

#### SOX compliance

Meet Sarbanes-Oxley Act (SOX) requirements:

* Retain financial system access logs
* Document change management processes
* Implement segregation of duties monitoring

#### GDPR compliance

Meet General Data Protection Regulation (GDPR) requirements:

* Track personal data access and processing
* Implement data subject request handling
* Monitor cross-border data transfers

#### HIPAA compliance

Meet Health Insurance Portability and Accountability Act (HIPAA)
requirements:

* Log all PHI access attempts
* Monitor user access patterns
* Implement breach detection capabilities

#### PCI DSS compliance

Meet Payment Card Industry Data Security Standard (PCI DSS) requirements:

* Track cardholder data environment access
* Monitor privileged account usage
* Implement file integrity monitoring

### Document audit procedures

Maintain comprehensive documentation for audit processes:

* **Data retention policies**: Document retention periods and rationale
* **Access procedures**: Define who can access audit logs and when
* **Investigation workflows**: Standard procedures for security incidents
* **Compliance reporting**: Templates and schedules for regulatory reports

## Incident response integration

### Prepare for security incidents

Integrate audit logs into your incident response plan:

#### Detection phase

* Automated alerting on suspicious patterns
* Correlation with other security tools
* Baseline establishment for anomaly detection

#### Investigation phase

* Rapid audit log query capabilities
* Timeline reconstruction from audit events
* Evidence preservation procedures

#### Recovery phase

* Post-incident audit log analysis
* Lessons learned documentation
* Process improvement recommendations

## Test your audit log procedures

Regularly validate your audit log capabilities:

* **Quarterly testing**: Verify log collection and retention
* **Annual exercises**: Full incident response scenario testing
* **Continuous monitoring**: Automated health checks and alerting
