# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
require 'oci'
# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config
# Initialize service client with default config file
log_analytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
create_log_analytics_object_collection_rule_response =
log_analytics_client.create_log_analytics_object_collection_rule(
'EXAMPLE-namespaceName-Value',
OCI::LogAnalytics::Models::CreateLogAnalyticsObjectCollectionRuleDetails
.new(
name: 'EXAMPLE-name-Value',
compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
os_namespace: 'EXAMPLE-osNamespace-Value',
os_bucket_name: 'EXAMPLE-osBucketName-Value',
log_group_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value',
log_source_name: 'EXAMPLE-logSourceName-Value',
description: 'EXAMPLE-description-Value',
collection_type: 'HISTORIC_LIVE',
poll_since: 'EXAMPLE-pollSince-Value',
poll_till: 'EXAMPLE-pollTill-Value',
entity_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-entityId-Value',
char_encoding: 'EXAMPLE-charEncoding-Value',
is_enabled: true,
timezone: 'EXAMPLE-timezone-Value',
log_set: 'EXAMPLE-logSet-Value',
log_set_key: 'OBJECT_PATH',
log_set_ext_regex: 'EXAMPLE-logSetExtRegex-Value',
overrides: {
'EXAMPLE_KEY_ia7uN' => [
{
'matchType' => 'EXAMPLE-matchType-Value',
'matchValue' => 'EXAMPLE-matchValue-Value',
'propertyName' => 'EXAMPLE-propertyName-Value',
'propertyValue' => 'EXAMPLE-propertyValue-Value'
}
]
},
object_name_filters: %w[EXAMPLE--Value],
log_type: 'LOG',
is_force_historic_collection: false,
defined_tags: {
'EXAMPLE_KEY_yiXJO' => { 'EXAMPLE_KEY_sRmCm' => 'EXAMPLE--Value' }
},
freeform_tags: {
'EXAMPLE_KEY_gmgMM' => 'EXAMPLE_VALUE_U5FlIYZPHgh2Eqq7GdcM'
}
)
)
# Get the data from response
puts "#{create_log_analytics_object_collection_rule_response.data}"