Note
This parameter was introduced in OceanBase Database V4.2.4.
Description
audit_log_path specifies the output directory for audit logs.
Applicability
This parameter is applicable to only OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support the audit feature.
Limitations
Query the parameter
In the
systenant or a user tenant, you can execute theSHOW PARAMETERSstatement to query the parameter or query theGV$OB_PARAMETERSview for the parameter.Modify the parameter
You can use the
ALTER SYSTEM SETstatement to modify the parameter in thesystenant or a user tenant.
Attributes
| Attribute | Description |
|---|---|
| Type | String |
| Default value | "", which indicates an empty string. In this case, the default directory ${WORK_DIR}/audit is used. |
| Value range | file:///path....oss://dest.... |
| 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. |
Considerations
Local storage
Audit logs of different OBServer nodes in a tenant are stored to different directories. You can specify the same output path for different tenants in a cluster. In this case, a level that specifies the tenant ID is added in the directory structure. The directory structure of a local output path 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 allows you to store audit logs of multiple OBServer nodes to the same directory in Alibaba Cloud OSS or Network File System (NFS). Logs will be concurrently appended to files in the local
auditdirectory, and the local files will be accessed in subsequent compression and encryption. Therefore, only archived files are moved to cloud storage, thus ensuring the access performance. When audit logs in cloud storage are consumed downstream, a part of the latest audit logs locally stored on OBServer nodes are unavailable for the downstream consumers.
Examples
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://$OSS_ACCESS_ID:$OSS....obclient> ALTER SYSTEM SET audit_log_path='oss://$OSS_ACCESS_ID:$OSS_ACCESS_KEY@$OSS_HOST/test/audit/';