Note
- For V4.3.x, this parameter was introduced in V4.3.3.
- For V4.2.x, this parameter was introduced in V4.2.4.
Description
audit_log_path specifies the output directory for audit logs.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support the auditing feature.
Privilege requirements
Query the parameter
The
systenant and all user tenants can query this parameter by using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify the parameter
The
systenant and user tenants can modify this parameter by using theALTER SYSTEM SETstatement.
Attributes
| Attribute | Description |
|---|---|
| Type | String |
| Default value | "" (empty string), which indicates the default path ${WORK_DIR}/audit. |
| Value range |
|
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Usage
Local storage
Audit logs from different OBServers in the same tenant are written to different directories. In a single cluster, you can set the same output path for different tenants. In this case, the directory structure includes an additional
tenant_idlayer. The local output directory structure is as follows:- ${audit_log_path} - tenant_id_1 - ip1:port1 - audit.log.20231031080646317[.zst] - audit.log.20231031084835263[.zst] - audit.log - ip2:port2 - audit.log.20231031072457838[.zst] - audit.log.20231031093023607[.zst] - audit.log.20231031101213751[.zst] - audit.log - tenant_id_2Cloud storage
OceanBase Database supports writing audit logs from multiple OBServers to the same
oss/nfsdirectory. To ensure the performance of concurrent append writes and support compression and encryption, only archived files are stored in cloud storage. Append writes are performed on local files in theauditdirectory. When you consume audit logs from cloud storage, the most recent records may exist only on the local OBServer and may not be visible to downstream consumers.
Example
Set the output directory for audit logs to
file:///logs/audit.obclient> ALTER SYSTEM SET audit_log_path='file:///logs/audit';Set the output directory for audit logs to
oss://ob-audit/audit/?host=$OSS_HOST&access_id=$OSS_ACCESS_ID&access_key=$OSS_ACCESS_KEY.obclient> ALTER SYSTEM SET audit_log_path = 'oss://ob-audit/audit/?host=$OSS_HOST&access_id=$OSS_ACCESS_ID&access_key=$OSS_ACCESS_KEY';