More Info:
OCI Audit service should be enabled to capture all API calls and events. Audit logs are essential for security investigations, compliance reporting, and detecting unauthorized activityRisk Level
MediumAddress
Compliance, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- AWS Startup Security Baseline
- AWS Well Architected Framework
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS AWS
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- Essential 8
- FedRAMP
- GDPR
- HIPAA
- ISO 27001
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST
- NIST CSF
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- PCI
- Reserve Bank of India (RBI) Cyber Security Framework
- Reserve Bank of India (RBI) Master Direction – Information Technology Framework
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are the exact console steps to enable OCI Audit logs in Logging (the usual remediation for “OCI Logging Audit Should Be Enabled” using the OCI Console):
1. Open Logging in the correct compartment
- Sign in to the OCI Console.
- At the top, select the correct Region.
- In the left menu, go to:
Observability & Management → Logging → Log groups. - In the upper-left compartment selector, choose the compartment where you want to store the Audit logs (commonly the root compartment or a central logging compartment).
2. Create (or choose) a Log Group
- If you don’t already have a log group for audit logs, click Create log group.
- Enter:
- Name (e.g.,
audit-log-group) - Description (optional)
- Confirm the Compartment.
- Name (e.g.,
- Click Create.
3. Enable the Audit service log
- In the same compartment, go to:
Observability & Management → Logging → Logs. - Click Enable service log.
- Fill in:
- Compartment: the compartment whose Audit events you want to log.
- Service: select Audit.
- Resource: choose tenancy or the specific resource scope (commonly the tenancy).
- Log category: usually Audit (or the default shown).
- Log group: select the log group created above (e.g.,
audit-log-group). - Name: e.g.,
audit-log.
- Confirm State is set to Enabled.
- Click Enable log.
4. (Optional) Send Audit logs to Monitoring / Alarms
If “for Logging Monitoring” means you want alerts based on Audit logs:- Create a Service Connector:
Observability & Management → Service Connectors → Create service connector.- Source: Logging
- Source log group: the log group with your Audit log
- (Optionally filter for specific log content)
- Target: Logging or Streaming (then you can feed into Functions, custom processing, etc.).
- Create Alarms in Monitoring → Alarms using metrics/logs produced by your processing pipeline, as applicable to your architecture.
Using CLI
Using CLI
In OCI, Audit is always on, but “Logging Audit should be enabled” usually means:
Otherwise, list compartments:Find the compartment OCID you want to use (e.g., the root compartment).Assume:
This outputs the Log Group OCID. Save it:If you already have a log group, you can get its OCID with:
This command:
Check that:
These steps enable OCI Logging for Audit events via the OCI CLI, which satisfies “OCI Logging Audit Should Be Enabled” for monitoring and compliance.
- Create a Log Group
- Create an Audit Log in that Log Group using the Logging service
(all via OCI CLI).
0. Prerequisites
- OCI CLI installed and configured (
~/.oci/configwith tenancy, user, key, region). - You have permission:
manage log-groupsandmanage logsin the target compartment (often the root compartment).
1. Identify the Compartment
Typically you enable Audit logging in the root compartment of the tenancy.If you already know the compartment OCID, skip to step 2.Otherwise, list compartments:
2. Create a Log Group (if you don’t already have one)
3. Create an Audit Log in the Log Group
Create a log that captures Audit service events:--log-type SERVICE→ tells Logging to collect from an OCI service.category: "audit"andservice: "audit"→ specifically select Audit logs.--is-enabled true→ enables the log immediately.
4. Verify the Log Is Enabled
"is-enabled": true"logType": "SERVICE"configuration.source.serviceis"audit"configuration.source.categoryis"audit"
5. (Optional) Enable Logs via Existing Log Group Only
If you just want to ensure any existing Audit log is enabled:-
List logs in the log group:
-
For any Audit log you find, enable it:
These steps enable OCI Logging for Audit events via the OCI CLI, which satisfies “OCI Logging Audit Should Be Enabled” for monitoring and compliance.
Using Python
Using Python
To enable OCI Audit logs (and similarly Monitoring service logs) via Python, you use the OCI Python SDK and the LoggingManagementClient to create a log in a log group.Below is a minimal, step‑by‑step approach.
This script:
1. Prerequisites
- Install OCI SDK:
- Ensure you have a valid OCI config file, usually at
~/.oci/config, with:
- Tenancy OCID
- User OCID
- Fingerprint
- Private key path
- Region
- IAM policies (attached to a group your user/API key belongs to), for example:
2. Enable Audit Logging in OCI Logging (Python)
This creates (if needed) a log group and an Audit log in the root compartment.- Ensures a log group exists in the root compartment.
- Creates an enabled Audit log that sends Audit events to the Logging service.
3. Enabling Monitoring Service Logs in the Same Way
To remediate “OCI Logging Monitoring” (e.g., enabling logs for the Monitoring service), you create another SERVICE log in the same or a different log group, changing only the source details.Example:4. Applying Across Compartments (Optional)
If your requirement is “Audit Logging must be enabled everywhere,” you can:- Use
IdentityClient.list_compartmentswithcompartment_id_in_subtree=True. - Loop through compartments and:
- Create/find a log group per compartment.
- Create an Audit log (and Monitoring log) in each.
Using Terraform
Using Terraform
OCID_OF_TARGET_COMPARTMENTwith the OCID of the compartment where you want to store the audit logs.
terraform plan should show creation (or update) of:oci_logging_log_group.audit_log_groupoci_logging_log.audit_logwithis_enabled = true,log_type = "SERVICE", andservice = "audit".

