Oracle Cloud Infrastructure Logging Analytics
Send logs to Oracle Cloud Infrastructure Logging Analytics Service
The Oracle Cloud Infrastructure Logging Analytics output plugin lets you ingest your log records into the Oracle Cloud Infrastructure (OCI) Logging Analytics service.
Configuration parameters
This plugin uses the following configuration parameters:
config_file_location
The location of the configuration file that contains OCI authentication details.
none
profile_name
The OCI configuration profile name to be used from the configuration file.
DEFAULT
namespace
The OCI tenancy namespace to upload log data to.
none
proxy
The proxy name, in http://host:port
format. Only supports HTTP protocol.
none
oci_config_in_record
If set to true
, the following oci_la_*
will be read from the record itself instead of the output plugin configuration.
false
oci_la_log_group_id
Required. The Oracle Cloud Identifier (OCID) of the Logging Analytics where you want to store logs.
none
oci_la_log_source_name
Required. The Logging Analytics Source to use for processing log records.
none
oci_la_entity_id
The OCID of the Logging Analytics entity.
none
oci_la_entity_type
The entity type of the Logging Analytics entity.
none
oci_la_log_path
Specifies the original location of the log files.
none
oci_la_global_metadata
Specifies additional global metadata along with original log content to Logging Analytics. The format is key_name value
. This option can be set multiple times.
none
oci_la_metadata
Specifies additional metadata for a log event along with original log content to Logging Analytics. The format is key_name value
. This option can be set multiple times.
none
TLS/SSL
The OCI Logging Analytics output plugin supports TLS/SSL. For more details about the properties available and general configuration, see TLS/SSL.
Get started
Prerequisites
You must onboard with the OCI Logging Analytics service for the minimum required policies in the OCI region where you want to monitor. Refer to Logging Analytics Quick Start for details.
You must create one or more OCI Logging Analytics log groups. Refer to Create Log Group for details.
Run the output plugin
To insert records into the OCI Logging Analytics service, you can run the plugin from the command line or through a configuration file.
Command line
The OCI Logging Analytics plugin can read the parameters from the command line in two ways, through the -p
(property) argument. For example:
fluent-bit -i dummy -t dummy -o oci_logan -p config_file_location=<location> -p namespace=<namespace> \
-p oci_la_log_group_id=<lg_id> -p oci_la_log_source_name=<ls_name> -p tls=on -p tls.verify=off -m '*'
Configuration file
In your main configuration file append the following:
pipeline:
inputs:
- name: dummy
tag: dummy
outputs:
- name: oracle_log_analytics
match: '*'
namespace: <namespace>
config_file_location: <location>
profile_name: ADMIN
oci_la_log_source_name: <log-source-name>
oci_la_log_group_id: <log-group-ocid>
tls: on
tls.verify: off
Insert oci_la
configurations in the record
oci_la
configurations in the recordIn case of multiple inputs, where oci_la_*
properties can differ, you can add the properties in the record itself and instruct the plugin to read these properties from the record. The option oci_config_in_record
, when set to true
in the output config, will make the plugin read the mandatory and optional oci_la
properties from the incoming record. The user must ensure that the necessary configurations have been inserted using relevant filters, otherwise the respective chunk will be dropped. The following example inserts oci_la_log_source_name
and oci_la_log_group_id
in the record:
pipeline:
inputs:
- name: dummy
tag: dummy
filters:
- name: modify
match: '*'
add:
- oci_la_log_source_name <LOG_SOURCE_NAME>
- oci_la_log_group_id <LOG_GROUP_OCID>
outputs:
- name: oracle_log_analytics
match: '*'
config_file_location: <oci_file_path>
profile_name: ADMIN
oci_config_in_record: true
tls: on
tls.verify: off
Add optional metadata
You can attach certain metadata to the log events collected from various inputs.
pipeline:
inputs:
- name: dummy
tag: dummy
outputs:
- name: oracle_log_analytics
match: '*'
namespace: example_namespace
config_file_location: /Users/example_file_location
profile_name: ADMIN
oci_la_log_source_name: example_log_source
oci_la_log_group_id: ocid.xxxxxx
oci_la_global_metadata:
- glob_key1 value1
- glob_key2 value2
oci_la_metadata:
- key1 value1
- key2 value2
tls: on
tls.verify: off
The previous configuration will generate a payload that resembles the following:
{
"metadata": {
"glob_key1": "value1",
"glob_key2": "value2"
},
"logEvents": [
{
"metadata": {
"key1": "value1",
"key2": "value2"
},
"logSourceName": "example_log_source",
"logRecords": [
"dummy"
]
}
]
}
The multiple oci_la_global_metadata
and oci_la_metadata
options are turned into a JSON object of key value pairs, nested under the key metadata.
With oci_config_in_record
option set to true
, the metadata key/value pairs will need to be injected in the record as an object of key/value pairs nested under the respective metadata field. The following example shows one such configuration:
pipeline:
inputs:
- name: dummy
tag: dummy
filters:
- name: modify
match: '*'
add:
- olgm.key1 val1
- olgm.key2 val2
- name: nest
match: '*'
operation: olgm.*
wildcard: olgm.*
nest_under: oci_la_global_metadata
remove_prefix: olgm.
- name: modify
match: '*'
add:
- oci_la_log_source_name <LOG_SOURCE_NAME>
- oci_la_log_group_id <LOG_GROUP_OCID>
outputs:
- name: oracle_log_analytics
match: '*'
config_file_location: <oci_file_path>
namespace: <oci_tenancy_namespace>
profile_name: ADMIN
oci_config_in_record: true
tls: on
tls.verify: off
The previous configuration first injects the necessary metadata keys and values in the record directly, with a prefix olgm.
attached to the keys, which segregates the metadata keys from rest of the record keys. Then, using a nest
filter, only the metadata keys are selected by the filter and nested under the oci_la_global_metadata
key in the record, and the prefix olgm.
is removed from the metadata keys.
Last updated
Was this helpful?