Oracle - OpenTelemetry Collector
The Oracle app is a logs and metrics based app. Preconfigured dashboards and searches provide insight into the listeners, audit logs (traditional - sys/xml and unified), performance, and security. It also gives insight around count of rollback, commits, transaction, process, session, hard parse, and DML locks.
This app is tested with the following Oracle versions:
- Non-Kubernetes: Oracle Database 23 Release 23.4.0.24.05.
Oracle logs, such as listener, alert, and traditional audit logs (Oracle version 19c and below) are sent to Sumo Logic through OpenTelemetry filelog receiver whereas, unified audit logs (Oracle version 21c and above) are collected through syslog for the Linux environment and windowseventlog receiver for windows environment.
Metrics are collected through Oracledb receiver.
Fields creation in Sumo Logic for Oracle​
Following are the tags which that be created as part of Oracle App install if not already present.Â
sumo.datasource
. Has a fixed value of oracle.db.system
. Has a fixed value of oracle.db.cluster.name
. User configured. Enter a name to identify this Oracle cluster. This cluster name will be shown in the Sumo Logic dashboards.db.node.name
. Has the value of host name of the machine which is being monitored.
Prerequisites​
For metrics collection​
You will need to assign these permissions to the database user used to fetch metrics:
GRANT SELECT ON V_$SESSION TO <username>;
GRANT SELECT ON V_$SYSSTAT TO <username>;
GRANT SELECT ON V_$RESOURCE_LIMIT TO <username>;
GRANT SELECT ON DBA_TABLESPACES TO <username>;
GRANT SELECT ON DBA_DATA_FILES TO <username>;
GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO <username>;
For logs collection​
Here are the steps required to configure log collection for Oracle running on a non-Kubernetes environment.
- Enable Oracle logging
- Verify log files path
- Set up Oracle performance metrics script
- Configure three local log file Sources
Enable Oracle logging​
If logging is not enabled, you can configure it by following the steps below.
- Alert log. Alert logs contain important information about error messages and exceptions that occur during database operations.
- Listener log. To enable listener log, run the following commands from
ORACLE_HOME/bin
:lsnrctl command [listener_name]
lsnrctl set log_status on - Audit Log. Traditional auditing is deprecated in Oracle Database 21c. If you are using version 19c or below follow this guide to enable Audit Logs. For version 21c and above, follow this to enable exporting for unified audit logs through syslog for Oracle on Linux and windows event logs for Oracle on Windows.
Verify local logs file directories and path​
- Oracle Alert Logs. For 11g and later releases (12c, 18c, 19c, 21c, 23c). By default, Oracle logs are stored in
$ORACLE_BASE/diag/rdbms/$DB_UNIQUE_NAME/$ORACLE_SID/trace/
. The default directory for log files is stored inBACKGROUND_DUMP_DEST
parameter. You can query the value ofBACKGROUND_DUMP_DEST
, an initialization parameter, where you can find Oracle alert log by executing the command below:SQL > show parameter background_dump_dest;
- Oracle Listener Logs. You can check listener log file with the following command:
[oracle@sumolab alert]$ lsnrctl status
- Oracle Audit Logs.
-
For Oracle version 19c and below. By default, Oracle logs are stored in
$ORACLE_BASE/app/oracle/admin/orcl/adump
The default directory for log files is stored as the value of
audit_file_dest
. In order to display it, run the following command:SQL> show parameter audit
.Audit Logs should be in either
XML
,EXTENDED
, or{{OS }}
format for the app to work.The location of these logs will be required when you set up the app through the app catalog.
-
For Oracle version 21c and above. Based on the Unified audit policy configured, audit logs exported will be directly ingested to Sumo Logic using syslog or windows event log. For the Linux environment, instead of redirecting audit logs to a file, we need to redirect them to the local port. In the next step, the OTel collector can be configured to listen to this port and then send the log to Sumo Logic. This can be done using the below configuration in the
rsyslog.conf
. :local7.info @@127.0.0.1:10514
This will redirect all the unified audit logs to localhost port 10514.
-
Performance metrics script setup​
To set up the performance metrics script on Linux and Windows for the Oracle app:
- Follow these instructions for your operating system. You do not need to configure the Sumo Logic Script Source at this time.
- As per the above instructions, once the python script is available locally, you need to trigger this script periodically by copying the cronJob.py file. This will generate an output log file, path for which needs to be given at the time of app installation. Based on your platform please follow the steps below:
- Linux
- Windows
Configure a cron job to trigger the python script using crontab. Frequency of this job can be set following the instructions from here.
-
To find the python3 path, you can run:Â
which python3
-
Here is the command which needs to be configured as part of cron to trigger the script:
<frequency_expression> <output_of_which_python3> <path_to_cronJob.py> <path_to_oracle-perf-monitor.py> <timeout_in_seconds> <output_location_of_file>
- Find the location of python.exe by running:
where python3
- Create a
.bat
file with the following arguments:@ECHO OFF
<output_of_where_python3> <path_to_cronJob.py> <path_to_oracle-perf-monitor.py> <timeout_in_seconds> <output_location_of_file>
The .bat
file created above can then be triggered periodically using windows Task Scheduler following an example here.
For Linux systems with ACL Support, the otelcol install process should have created the ACL grants necessary for the otelcol system user to access default log locations. You can verify the active ACL grants using the getfacl
command. Install the ACL in your Linux environment, if not installed.
The required ACL may not be supported for some rare cases, for example, Linux OS Distro, which is officially not supported by Sumo Logic. In this case, you can run the following command to explicitly grant the permissions.
sudo setfacl -R -m d:u:otelcol-sumo:r-x,d:g:otelcol-sumo:r-x,u:otelcol-sumo:r-x,g:otelcol-sumo:r-x <PATH_TO_LOG_FILE>
Run the above command for all the log files in the directory that need to be ingested, which are not residing in the default location.
If Linux ACL Support is not available, traditional Unix-styled user and group permission must be modified. It should be sufficient to add the otelcol system user to the specific group that has access to the log files.
For Windows systems, log files which are collected should be accessible by the SYSTEM group. Use the following set of PowerShell commands if the SYSTEM group does not have access.
$NewAcl = Get-Acl -Path "<PATH_TO_LOG_FILE>"
# Set properties
$identity = "NT AUTHORITY\SYSTEM"
$fileSystemRights = "ReadAndExecute"
$type = "Allow"
# Create new rule
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
# Apply new rule
$NewAcl.SetAccessRule($fileSystemAccessRule)
Set-Acl -Path "<PATH_TO_LOG_FILE>" -AclObject $NewAcl
Collection configuration and app installation​
As part of data collection setup and app installation, you can select the App from App Catalog and click on Install App. Follow the steps below.