oracle.oci.oci_log_analytics_object_collection_rule – Manage a LogAnalyticsObjectCollectionRule resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.13.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_log_analytics_object_collection_rule.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a LogAnalyticsObjectCollectionRule resource in Oracle Cloud Infrastructure

  • For state=present, creates a rule to collect logs from an object storage bucket.

  • This resource has the following action operations in the oracle.oci.oci_log_analytics_object_collection_rule_actions module: change_compartment.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
char_encoding
string
An optional character encoding to aid in detecting the character encoding of the contents of the objects while processing. It is recommended to set this value as ISO_8859_1 when configuring content of the objects having more numeric characters, and very few alphabets. For e.g. this applies when configuring VCN Flow Logs.
This parameter is updatable.
collection_type
string
    Choices:
  • LIVE
  • HISTORIC
  • HISTORIC_LIVE
The type of collection.
compartment_id
string
The OCID of the compartment to which this rule belongs.
Required for create using state=present.
Required for update when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
Required for delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`
This parameter is updatable.
description
string
A string that describes the details of the rule. It does not have to be unique, and can be changed. Avoid entering confidential information.
This parameter is updatable.
entity_id
string
Logging Analytics entity OCID. Associates the processed logs with the given entity (optional).
This parameter is updatable.
force_create
boolean
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
dictionary
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`
This parameter is updatable.
is_enabled
boolean
    Choices:
  • no
  • yes
Whether or not this rule is currently enabled.
This parameter is updatable.
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
log_analytics_object_collection_rule_id
string
The Logging Analytics Object Collection Rule OCID.
Required for update using state=present when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.
Required for delete using state=absent when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: id
log_group_id
string
Logging Analytics Log group OCID to associate the processed logs with.
Required for create using state=present.
This parameter is updatable.
log_set
string
The logSet to be associated with the processed logs. The logSet feature can be used by customers with high volume of data and this feature has to be enabled for a given tenancy prior to its usage. When logSetExtRegex value is provided, it will take precedence over this logSet value and logSet will be computed dynamically using logSetKey and logSetExtRegex.
This parameter is updatable.
log_set_ext_regex
string
The regex to be applied against given logSetKey. Regex has to be in string escaped format.
This parameter is updatable.
log_set_key
string
    Choices:
  • OBJECT_PATH
An optional parameter to indicate from where the logSet to be extracted using logSetExtRegex. Default value is OBJECT_PATH (e.g. /n/<namespace>/b/<bucketname>/o/<objectname>).
This parameter is updatable.
log_source_name
string
Name of the Logging Analytics Source to use for the processing.
Required for create using state=present.
This parameter is updatable.
name
string
A unique name given to the rule. The name must be unique within the tenancy, and cannot be modified.
Required for create using state=present.
Required for update, delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
namespace_name
string / required
The Logging Analytics namespace used for the request.
object_name_filters
list / elements=string
When the filters are provided, only the objects matching the filters are picked up for processing. The matchType supported is exact match and accommodates wildcard "*". For more information on filters, see Event Filters.
This parameter is updatable.
os_bucket_name
string
Name of the Object Storage bucket.
Required for create using state=present.
os_namespace
string
Object Storage namespace.
Required for create using state=present.
overrides
dictionary
The override is used to modify some important configuration properties for objects matching a specific pattern inside the bucket. Supported propeties for override are: logSourceName, charEncoding, entityId. Supported matchType for override are "contains".
This parameter is updatable.
poll_since
string
The oldest time of the file in the bucket to consider for collection. Accepted values are: BEGINNING or CURRENT_TIME or RFC3339 formatted datetime string. Use this for HISTORIC or HISTORIC_LIVE collection types. When collectionType is LIVE, specifying pollSince value other than CURRENT_TIME will result in error.
poll_till
string
The newest time of the file in the bucket to consider for collection. Accepted values are: CURRENT_TIME or RFC3339 formatted datetime string. Use this for HISTORIC collection type. When collectionType is LIVE or HISTORIC_LIVE, specifying pollTill will result in error.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
state
string
    Choices:
  • present ←
  • absent
The state of the LogAnalyticsObjectCollectionRule.
Use state=present to create or update a LogAnalyticsObjectCollectionRule.
Use state=absent to delete a LogAnalyticsObjectCollectionRule.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
timezone
string
Timezone to be used when processing log entries whose timestamps do not include an explicit timezone. When this property is not specified, the timezone of the entity specified is used. If the entity is also not specified or do not have a valid timezone then UTC is used.
This parameter is updatable.
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.

Examples

- name: Create log_analytics_object_collection_rule
  oci_log_analytics_object_collection_rule:
    # required
    name: name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    os_namespace: os_namespace_example
    os_bucket_name: os_bucket_name_example
    log_group_id: "ocid1.loggroup.oc1..xxxxxxEXAMPLExxxxxx"
    log_source_name: log_source_name_example
    namespace_name: namespace_name_example

    # optional
    collection_type: LIVE
    poll_since: poll_since_example
    poll_till: poll_till_example
    description: description_example
    entity_id: "ocid1.entity.oc1..xxxxxxEXAMPLExxxxxx"
    char_encoding: char_encoding_example
    is_enabled: true
    timezone: timezone_example
    log_set: log_set_example
    log_set_key: OBJECT_PATH
    log_set_ext_regex: log_set_ext_regex_example
    overrides: null
    object_name_filters: [ "object_name_filters_example" ]
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    freeform_tags: {'Department': 'Finance'}

- name: Update log_analytics_object_collection_rule
  oci_log_analytics_object_collection_rule:
    # required
    namespace_name: namespace_name_example
    log_analytics_object_collection_rule_id: "ocid1.loganalyticsobjectcollectionrule.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    description: description_example
    log_group_id: "ocid1.loggroup.oc1..xxxxxxEXAMPLExxxxxx"
    log_source_name: log_source_name_example
    entity_id: "ocid1.entity.oc1..xxxxxxEXAMPLExxxxxx"
    char_encoding: char_encoding_example
    is_enabled: true
    timezone: timezone_example
    log_set: log_set_example
    log_set_key: OBJECT_PATH
    log_set_ext_regex: log_set_ext_regex_example
    overrides: null
    object_name_filters: [ "object_name_filters_example" ]
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    freeform_tags: {'Department': 'Finance'}

- name: Update log_analytics_object_collection_rule using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_log_analytics_object_collection_rule:
    # required
    name: name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    namespace_name: namespace_name_example

    # optional
    description: description_example
    log_group_id: "ocid1.loggroup.oc1..xxxxxxEXAMPLExxxxxx"
    log_source_name: log_source_name_example
    entity_id: "ocid1.entity.oc1..xxxxxxEXAMPLExxxxxx"
    char_encoding: char_encoding_example
    is_enabled: true
    timezone: timezone_example
    log_set: log_set_example
    log_set_key: OBJECT_PATH
    log_set_ext_regex: log_set_ext_regex_example
    overrides: null
    object_name_filters: [ "object_name_filters_example" ]
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    freeform_tags: {'Department': 'Finance'}

- name: Delete log_analytics_object_collection_rule
  oci_log_analytics_object_collection_rule:
    # required
    namespace_name: namespace_name_example
    log_analytics_object_collection_rule_id: "ocid1.loganalyticsobjectcollectionrule.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

- name: Delete log_analytics_object_collection_rule using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_log_analytics_object_collection_rule:
    # required
    name: name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    namespace_name: namespace_name_example
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
log_analytics_object_collection_rule
complex
on success
Details of the LogAnalyticsObjectCollectionRule resource acted upon by the current operation

Sample:
{'char_encoding': 'char_encoding_example', 'collection_type': 'LIVE', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'description': 'description_example', 'entity_id': 'ocid1.entity.oc1..xxxxxxEXAMPLExxxxxx', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_enabled': True, 'lifecycle_details': 'lifecycle_details_example', 'lifecycle_state': 'ACTIVE', 'log_group_id': 'ocid1.loggroup.oc1..xxxxxxEXAMPLExxxxxx', 'log_set': 'log_set_example', 'log_set_ext_regex': 'log_set_ext_regex_example', 'log_set_key': 'OBJECT_PATH', 'log_source_name': 'log_source_name_example', 'name': 'name_example', 'object_name_filters': [], 'os_bucket_name': 'os_bucket_name_example', 'os_namespace': 'os_namespace_example', 'overrides': {}, 'poll_since': 'poll_since_example', 'poll_till': 'poll_till_example', 'time_created': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00', 'timezone': 'timezone_example'}
 
char_encoding
string
on success
An optional character encoding to aid in detecting the character encoding of the contents of the objects while processing. It is recommended to set this value as ISO_8859_1 when configuring content of the objects having more numeric characters, and very few alphabets. For e.g. this applies when configuring VCN Flow Logs.

Sample:
char_encoding_example
 
collection_type
string
on success
The type of log collection.

Sample:
LIVE
 
compartment_id
string
on success
The OCID of the compartment to which this rule belongs.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
description
string
on success
A string that describes the details of the rule. It does not have to be unique, and can be changed. Avoid entering confidential information.

Sample:
description_example
 
entity_id
string
on success
Logging Analytics entity OCID to associate the processed logs with.

Sample:
ocid1.entity.oc1..xxxxxxEXAMPLExxxxxx
 
freeform_tags
dictionary
on success
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
The OCID of this rule.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
is_enabled
boolean
on success
Whether or not this rule is currently enabled.

Sample:
True
 
lifecycle_details
string
on success
A detailed status of the life cycle state.

Sample:
lifecycle_details_example
 
lifecycle_state
string
on success
The current state of the rule.

Sample:
ACTIVE
 
log_group_id
string
on success
Logging Analytics Log group OCID to associate the processed logs with.

Sample:
ocid1.loggroup.oc1..xxxxxxEXAMPLExxxxxx
 
log_set
string
on success
The logSet to be associated with the processed logs. The logSet feature can be used by customers with high volume of data and this feature has to be enabled for a given tenancy prior to its usage. When logSetExtRegex value is provided, it will take precedence over this logSet value and logSet will be computed dynamically using logSetKey and logSetExtRegex.

Sample:
log_set_example
 
log_set_ext_regex
string
on success
The regex to be applied against given logSetKey. Regex has to be in string escaped format.

Sample:
log_set_ext_regex_example
 
log_set_key
string
on success
An optional parameter to indicate from where the logSet to be extracted using logSetExtRegex. Default value is OBJECT_PATH (e.g. /n/<namespace>/b/<bucketname>/o/<objectname>).

Sample:
OBJECT_PATH
 
log_source_name
string
on success
Name of the Logging Analytics Source to use for the processing.

Sample:
log_source_name_example
 
name
string
on success
A unique name to the rule. The name must be unique, within the tenancy, and cannot be changed.

Sample:
name_example
 
object_name_filters
list / elements=string
on success
When the filters are provided, only the objects matching the filters are picked up for processing. The matchType supported is exact match and accommodates wildcard "*". For more information on filters, see Event Filters.

 
os_bucket_name
string
on success
Name of the Object Storage bucket.

Sample:
os_bucket_name_example
 
os_namespace
string
on success
Object Storage namespace.

Sample:
os_namespace_example
 
overrides
dictionary
on success
Use this to override some property values which are defined at bucket level to the scope of object. Supported propeties for override are: logSourceName, charEncoding, entityId. Supported matchType for override are "contains".

 
poll_since
string
on success
The oldest time of the file in the bucket to consider for collection. Accepted values are: BEGINNING or CURRENT_TIME or RFC3339 formatted datetime string. Use this for HISTORIC or HISTORIC_LIVE collection types. When collectionType is LIVE, specifying pollSince value other than CURRENT_TIME will result in error.

Sample:
poll_since_example
 
poll_till
string
on success
The newest time of the file in the bucket to consider for collection. Accepted values are: CURRENT_TIME or RFC3339 formatted datetime string. Use this for HISTORIC collection type. When collectionType is LIVE or HISTORIC_LIVE, specifying pollTill will result in error.

Sample:
poll_till_example
 
time_created
string
on success
The time when this rule was created. An RFC3339 formatted datetime string.

Sample:
2013-10-20T19:20:30+01:00
 
time_updated
string
on success
The time when this rule was last updated. An RFC3339 formatted datetime string.

Sample:
2013-10-20T19:20:30+01:00
 
timezone
string
on success
Timezone to be used when processing log entries whose timestamps do not include an explicit timezone. When this property is not specified, the timezone of the entity specified is used. If the entity is also not specified or do not have a valid timezone then UTC is used.

Sample:
timezone_example


Authors

  • Oracle (@oracle)