Table: oci_logging_log - Query OCI Logging Logs using SQL
Oracle Cloud Infrastructure's (OCI) Logging service is a highly scalable and fully managed single pane of glass for all the logs in your tenancy. The service helps you to manage and analyze logs from your resources in Oracle Cloud Infrastructure, your applications, and your on-premises resources. This makes it easier to monitor, troubleshoot, and react to operational and security issues.
Table Usage Guide
The oci_logging_log
table provides insights into logs within Oracle Cloud Infrastructure's (OCI) Logging service. As a system administrator, this table is useful to explore log-specific details, including the log group it belongs to, the log type, and the configuration details. Utilize it to uncover information about logs, such as those with specific configurations, the relationships between logs and log groups, and the status of each log.
Examples
Basic info
Explore which logs have been created within your Oracle Cloud Infrastructure (OCI) environment, and assess their lifecycle state to understand if they are active or deleted. This can be useful for managing and tracking your OCI resources.
select id, log_group_id, name, lifecycle_state, time_createdfrom oci_logging_log;
select id, log_group_id, name, lifecycle_state, time_createdfrom oci_logging_log;
List inactive logs
Identify logs that are currently inactive. This can be useful in managing system resources or troubleshooting system issues by focusing on logs that are not actively recording data.
select id, name, lifecycle_state as state, time_createdfrom oci_logging_logwhere lifecycle_state = 'INACTIVE';
select id, name, lifecycle_state as state, time_createdfrom oci_logging_logwhere lifecycle_state = 'INACTIVE';
List VCN subnets with flow logging enabled
Assess the elements within your network by identifying active subnets that have flow logging enabled. This can help enhance network security and troubleshooting by providing visibility into traffic patterns and potential anomalies.
select configuration -> 'source' ->> 'resource' as subnet_id, configuration -> 'source' ->> 'service' as service, lifecycle_statefrom oci_logging_logwhere configuration -> 'source' ->> 'service' = 'flowlogs' and lifecycle_state = 'ACTIVE';
select json_extract(configuration, '$.source.resource') as subnet_id, json_extract(configuration, '$.source.service') as service, lifecycle_statefrom oci_logging_logwhere json_extract(configuration, '$.source.service') = 'flowlogs' and lifecycle_state = 'ACTIVE';
Control examples
Schema for oci_logging_log
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
compartment_id | text | The OCID of the compartment in Tenant in which the resource is located. | |
configuration | jsonb | Log object configuration. | |
defined_tags | jsonb | Defined tags for resource. Defined tags are set up in your tenancy by an administrator. Only users granted permission to work with the defined tags can apply them to resources. | |
freeform_tags | jsonb | Free-form tags for resource. This tags can be applied by any user with permissions on the resource. | |
id | text | = | The OCID of the log. |
is_enabled | boolean | Whether or not this resource is currently enabled. | |
lifecycle_state | text | = | The log object state. |
log_group_id | text | = | The OCID of the log group. |
log_type | text | = | The logType that the log object is for, whether custom or service. |
name | text | = | A user-friendly name. |
region | text | The OCI region in which the resource is located. | |
retention_duration | bigint | Log retention duration in 30-day increments (30, 60, 90 and so on). | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tags | jsonb | A map of tags for the resource. | |
tenant_id | text | =, !=, ~~, ~~*, !~~, !~~* | The OCID of the Tenant in which the resource is located. |
tenant_name | text | The name of the Tenant in which the resource is located. | |
time_created | timestamp with time zone | Time the resource was created. | |
time_last_modified | timestamp with time zone | Time the resource was last modified. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- oci
You can pass the configuration to the command with the --config
argument:
steampipe_export_oci --config '<your_config>' oci_logging_log