More Info:
The OCI Audit service should be actively producing events. If audit is not enabled or has zero events, security-critical activities are not being recorded for investigation.Risk Level
MediumAddress
Compliance, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- 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)
- FedRAMP
- GDPR
- HIPAA
- 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
Here’s how to actively monitor OCI Audit logs using Logging search alerts and Notifications in the OCI Console.
1. Confirm Audit Logs Are Being Collected
- Sign in to the OCI Console.
- Open the navigation menu → Logging → Logs.
- In the top-left compartment selector, choose your root compartment (tenancy).
- Filter for Service = Audit or look for a log named Audit or Audit Logs.
- If present and showing recent entries, Audit logging is active (Audit is usually always-on; you’re verifying visibility in Logging).
2. Create a Notification Topic & Subscription
You will use OCI Notifications to receive alerts (email, Slack, etc.).- Open the navigation menu → Developer Services → Notifications → Topics.
- Click Create Topic.
- Name: e.g.
audit-alerts-topic - Description: e.g.
Alerts for OCI Audit events - Compartment: choose the compartment where you manage ops/security.
- Name: e.g.
- Click Create.
- On the topic details page, click Create Subscription.
- Choose protocol (e.g. Email).
- Enter destination (e.g. your security team’s email).
- Click Create.
- Go to your email and confirm the subscription (required before alerts are delivered).
3. Build a Logging Search for Audit Events
- Open the navigation menu → Logging → Logs.
- In the compartment selector, choose the compartment with your Audit log (often root).
- Click on the Audit log (the log resource, not a single entry).
- Click Search or View Log (depending on UI version).
-
Use a filter query defining what you want to be alerted on. For example, to catch sensitive API calls:
Example query:
Or to alert on any
ERROR: - Run the query and verify it returns the events you care about.
4. Create a Logging Alert from the Search
- With the query loaded and validated, look for Create Alert or Save as Alert (typically near the search bar).
- Click Create Alert (wording may be “Create” → “Alert Rule” or similar).
-
Name: e.g.
High-Risk Audit API Calls Alert. -
Description: e.g.
Triggers when destructive or high-risk Audit events happen. - Compartment: choose where you manage security/ops resources.
- Query: your tested logging query should already be populated.
-
Schedule:
- Choose how frequently to run (e.g. Every 5 minutes or Every 15 minutes).
-
Trigger condition:
- Example: “Trigger when count of matches > 0”.
-
Notifications:
- Select Notifications Topic and choose the topic you created:
audit-alerts-topic.
- Select Notifications Topic and choose the topic you created:
- Save / Create the alert.
5. Test the Alert
- Perform a non-destructive test action that will generate a relevant Audit event (e.g. modify a test resource’s tag, or create/delete a small, non-critical resource, depending on your query).
- Wait for the schedule interval (e.g. 5–15 minutes).
- Confirm that:
- The event shows up under Logging → Audit log search.
- A notification email (or other protocol) is received.
6. Operationalize & Tune
- Refine queries to:
- Include only critical services / compartments.
- Exclude known-noisy operations.
- Create multiple alerts for different severities, e.g.:
- Critical destructive actions.
- IAM/Policy changes (
data.eventSource = "identity"). - Unexpected regions or compartments.
Using CLI
Using CLI
Below is a minimal, step‑by‑step way to ensure OCI Audit logs are actively monitored using OCI CLI:
Save the returned
Example:(If you already have a log group, you can list and pick one:)Save
Save Confirm the subscription from your email.
Below is a generic example usingNotes:
If you share the output of
- enable (or confirm) Audit logs are going into OCI Logging
- create a metric‑based alarm on those logs with OCI Monitoring
... placeholders (compartment OCIDs, regions, etc.) with your values.1. Prerequisites
Make sure:- OCI CLI is configured:
- You know:
- Tenancy OCID:
ocid1.tenancy.oc1..xxxxx - Compartment OCID for security/logging:
ocid1.compartment.oc1..xxxxx - Region: e.g.,
us-ashburn-1
- Tenancy OCID:
2. Ensure OCI Audit is sending logs to OCI Logging
OCI Audit is always on, but you must create a service log foraudit in Logging so you can monitor it.2.1 Create (or identify) a Log Group for Audit
"id" as LOG_GROUP_OCID.Example:
2.2 Create a service log for Audit
"id" as AUDIT_LOG_OCID (optional for later reference).3. Create a Monitoring Alarm for Audit Logs
Typical security control: alert if no audit events occur for a certain period (e.g., 1 hour) in a tenancy or key compartment.OCI exposes metrics for logs in namespaceoci_logging. When you enabled the service log, you can now build alarms on those metrics.3.1 Decide on alarm behavior
Example:- Trigger if no audit log entries are written for 1 hour.
- Evaluation period:
1h - Severity:
CRITICAL - Destination: an ONS topic (email/SNS endpoint).
"topic-id" as TOPIC_OCID.Then subscribe your email (one time only):3.2 Create the alarm
We’ll use the Logging metrics to detect when the Audit service log is completely quiet. Metric name examples:LogsVolume, LogsCount.Below is a generic example using
LogsCount — adjust as needed if your tenancy uses different metric names or dimensions.Alarm logic: if LogsCount for our Audit log group in the last hour is 0, raise an alarm.-
namespace "oci_logging"is used for Logging metrics. -
The exact metric name and dimensions (
LogsCount,logGroupId) may vary; if necessary, list available metrics:
resourceDisplayName = "audit-service-log" or by sourceService = "audit" if that dimension exists).4. (Optional) Alarm for high audit volume
You can also detect abnormal spikes (possible attack / misconfiguration). For example, alert if audit events > 10,000 in 5 minutes:5. Verification
-
List alarms:
-
Check their state:
- Confirm you receive email from the ONS topic when alarm triggers (you can temporarily lower thresholds or query values to force a test).
If you share the output of
oci monitoring metric list --namespace oci_logging I can give you an exact --query-text tailored to your environment.Using Python
Using Python
Below is one straightforward way to “actively monitor” the OCI Audit Logging service using Python:
Example: fire an alarm if the number of audit events suddenly spikes beyond a threshold.Below example:
- use the OCI Python SDK
- create an ONS notification topic and subscription
- create a Monitoring Alarm on Audit metrics (namespace
oci_audit)
0. Prerequisites
- Install OCI SDK:
- Configure
~/.oci/config(or use instance principals) with:- tenancy
- user
- fingerprint
- key_file
- region
- profile name (e.g.,
DEFAULT)
1. Create a Notification Topic and Subscription (Email) via Python
2. Create an Alarm on Audit Metrics via Python
You can monitor the Audit service using the metric namespaceoci_audit.Example: fire an alarm if the number of audit events suddenly spikes beyond a threshold.Below example:
- Metric namespace:
oci_audit - Metric:
audit.events.count - Condition:
sum(audit.events.count) > 100over a 5-minute window
(Tune this threshold to your environment.) - Sends notifications to the ONS topic created above.
3. Optional: Alarm for “No Audit Logs Seen”
To detect if the Audit service stops emitting events (e.g., misconfiguration, region issue), you can create an alarm on absence of data by using comparison to 0 withevaluate_missing_data = "EVALUATE_AS_ZERO" and a condition like:4. Validate
- In OCI Console:
- Go to Monitoring → Alarms
- Verify the alarms exist and are enabled.
- In Notifications:
- Confirm subscription is
CONFIRMED.
- Confirm subscription is
- Generate audit activity (e.g., create/delete small test resources) and ensure:
- Audit metrics update (Monitoring → Metrics →
oci_audit) - Alarms fire when thresholds are crossed and email is received.
- Audit metrics update (Monitoring → Metrics →
Using Terraform
Using Terraform
OCID_OF_TENANCY_OR_TARGET_COMPARTMENTwith the OCID where you want Audit logs configured (typically the tenancy/root compartment).
terraform plan should show is_enabled changing from false (or unset) to true on oci_logging_audit_configuration.audit_monitoring.
