Jindo AuditLog allows you to audit operations in the namespaces that are in block storage mode or in cache mode. Jindo AuditLog records addition, deletion, and renaming operations in the namespaces.
Prerequisites
- An E-MapReduce (EMR) cluster is created. For more information about how to create a cluster, see Create a cluster.
- An OSS bucket is created. For more information about how to create an OSS bucket, see Create buckets.
Background information
You can use AuditLog to analyze namespace access information, detect abnormal requests, and track errors. AuditLog stores log files in OSS. The size of a single log file cannot exceed 5 GB. You can use the lifecycle management feature of OSS to customize a retention period in days for the log files. JindoFS allows you to use Shell commands to analyze the log files generated by AuditLog.
Audit log
Parameter | Description |
---|---|
Time | The time format is yyyy-MM-dd hh:mm:ss.SSS. |
allowed | Indicates whether the operation is allowed. Valid values:
|
ugi | The user who performed the operation. The information about the authentication method is also displayed. |
ip | The client IP address. |
ns | The name of the namespace in block storage mode. |
cmd | The operation command. |
src | The source path. |
dest | The destination path. This parameter can be left empty. |
perm | The operation permissions on the file. |
2020-07-09 18:29:24.689 allowed=true ugi=hadoop (auth:SIMPLE) ip=127.0.0.1 ns=test-block cmd=CreateFileletRequest src=jfs://test-block/test/test.snappy.parquet dst=null perm=::rwxrwxr-x
Configure AuditLog
Analyze log files
JindoFS allows you to use SQL queries to analyze the log files generated by AuditLog.
You can use SQL queries to analyze the most active commands or IP addresses in the
tables. The analysis command is jindo sql
.
jindo sql
command uses the Spark SQL syntax, and is embedded with the audit_log_source, audit_log,
and fs_image tables. The audit_log_source table stores the original data of AuditLog.
The audit_log table stores the data of AuditLog after cleansing. The fs_image table
stores fsimage log data. The audit_log_source and fs_image tables are partitioned
tables. Usage:
- Use
jindo sql --help
to query the settings of the parameters described in the following table.Parameter Description -f Specifies the SQL file to run. -i Automatically runs the initialization SQL script after the jindo sql command is run. - Use
show partitions table_name
to obtain all partitions. - Use
desc formatted table_name
to view the table structure.
export JINDO_SPARK_OPTS="--conf spark.driver.memory=4G --conf spark.executor.instances=20 --conf spark.executor.cores=5 --conf spark.executor.memory=20G"
- Run the following command to display tables:
show tables;
- Run the following command to display partitions in the audit_log_source table:
show partitions audit_log_source;
The information similar to that shown in the following figure is returned. - Run the following commands to query data:
select * from audit_log_source limit 10;
The information similar to that shown in the following figure is returned.select * from audit_log limit 10;
The information similar to that shown in the following figure is returned. - Run the command shown in the following figure to collect statistics on the use frequencies
of different commands on October 20, 2020.