More Info:
Audit logs should be retained for at least 90 days. Insufficient retention limits the ability to investigate security incidents that may not be detected immediatelyRisk Level
MediumAddress
Compliance, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- Essential 8
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Here’s how to set OCI Logging retention to at least 90 days for Monitoring logs using the OCI Console:
-
Sign in & choose the correct compartment
- Log in to the OCI Console.
- At the top-left, select the Compartment where your Monitoring logs are located.
-
Open Logging
- In the left-side menu, go to:
Observability & Management → Logging → Log Groups.
- In the left-side menu, go to:
-
Select the relevant Log Group
- In your chosen compartment, click the Log Group that contains your Monitoring logs (for example,
monitoring-log-group, or where you configured Monitoring service logs).
- In your chosen compartment, click the Log Group that contains your Monitoring logs (for example,
-
Open the Monitoring Log
- Inside the log group, go to the Logs tab.
- Locate the Monitoring log (Type will usually be “Service” and Source something like
monitoring). - Click the name of that log.
-
Edit the retention period
- On the log details page, click Edit (or Edit Log).
- Find the Retention period setting.
- Change it to 90 days or higher (e.g., 90, 180, etc.).
-
Save the changes
- Click Save changes.
- Confirm the update if prompted.
-
Repeat for other Monitoring logs / compartments
- If you have multiple Monitoring logs in other log groups or compartments, repeat the steps so that each relevant Monitoring log has a retention of ≥ 90 days.
Using CLI
Using CLI
Here’s how to set at least 90 days retention for OCI Logging (Monitoring logs) using the OCI CLI.
Find the
(e.g.,Look for logs where
In the output, check the
You can also use a higher value, e.g.,
Ensure the returned value is
Verify:
Note: In OCI, retention is set on the log group, not the individual log. So you must update the log group where your Monitoring logs are stored.
1. Identify the Log Group for Monitoring Logs
If you already know the log group OCID, skip to step 2.List log groups in the compartment where your Monitoring logs reside:id of the log group that contains your Monitoring logs(e.g.,
id: "ocid1.loggroup.oc1....").If you need to confirm which logs are Monitoring logs in that group:source_service is oci_monitoring or similar.2. Check Current Retention on the Log Group
retention-duration (in days).3. Update Retention to at Least 90 Days
Set retention to 90 days (or higher if you prefer):--retention-duration 180.4. Verify the Change
>= 90.If You Also Need Audit Log Retention (Root Tenancy)
For Audit service retention at the tenancy level:Using Python
Using Python
Below is how to remediate this with Python using the OCI SDK by updating log retention to at least 90 days for Monitoring-related logs in OCI Logging.
This creates
If you clarify whether your “Audit” logs are:
1. Prerequisites
- Install the SDK:
- Configure your OCI CLI credentials (if not already):
~/.oci/config with your tenancy, user OCID, key, etc.2. Concept: What You Actually Change
Retention is set per log in the Logging service.- Resource:
Log(under aLogGroup) - Field:
retention_in_days - API:
LoggingManagementClient.update_log
- Find the right log group(s) and log(s) (e.g., logs for Monitoring / Audit).
- For each log, check
retention_in_days. - If < 90, update it to 90 (or more).
3. Python Example: Set Retention for Monitoring Logs to ≥ 90 Days
This script:- Uses your default OCI profile.
- Works in one region (set in your config).
- Searches all log groups in a compartment.
- For each log where
source_service == "monitoring"(i.e., Monitoring service logs), sets retention to 90 if it’s currently lower.
4. Adapting This for “Audit” Logs in Logging (If You’re Shipping Audit → Logging)
If your organization forwards Audit events into Logging (e.g., via Service Connector):- Change the filter to match how you identify those logs, e.g.:
- By
source_service == "audit", or - By
log_type == "SERVICE" and log.display_namepattern, etc.
- By
5. If You Actually Meant Native OCI Audit Service Retention
If the requirement is specifically “Audit logs retention ≥ 90 days” using the Audit service (not Logging), you must:- Use
oci.audit.AuditClient.update_configuration. - Set
retention_period_daysin the Audit configuration for the tenancy/compartment.
If you clarify whether your “Audit” logs are:
- native Audit service logs, or
- logs in Logging sourced from Audit/Monitoring,
Using Terraform
Using Terraform
retention_period_days does not force resource replacement; it updates in place.To verify, terraform plan should show the existing retention_period_days changing from its current value (e.g., 30) to 90:
