use of org.apache.cassandra.audit.AuditLogOptions in project cassandra by apache.
the class StorageService method enableAuditLog.
public void enableAuditLog(String loggerName, Map<String, String> parameters, String includedKeyspaces, String excludedKeyspaces, String includedCategories, String excludedCategories, String includedUsers, String excludedUsers, Integer maxArchiveRetries, Boolean block, String rollCycle, Long maxLogSize, Integer maxQueueWeight, String archiveCommand) throws ConfigurationException, IllegalStateException {
final AuditLogOptions options = new AuditLogOptions.Builder(DatabaseDescriptor.getAuditLoggingOptions()).withEnabled(true).withLogger(loggerName, parameters).withIncludedKeyspaces(includedKeyspaces).withExcludedKeyspaces(excludedKeyspaces).withIncludedCategories(includedCategories).withExcludedCategories(excludedCategories).withIncludedUsers(includedUsers).withExcludedUsers(excludedUsers).withMaxArchiveRetries(maxArchiveRetries).withBlock(block).withRollCycle(rollCycle).withMaxLogSize(maxLogSize).withMaxQueueWeight(maxQueueWeight).withArchiveCommand(archiveCommand).build();
AuditLogManager.instance.enable(options);
logger.info("AuditLog is enabled with configuration: {}", options);
}
use of org.apache.cassandra.audit.AuditLogOptions in project cassandra by apache.
the class GetAuditLog method execute.
@Override
protected void execute(NodeProbe probe) {
final TableBuilder tableBuilder = new TableBuilder();
tableBuilder.add("enabled", Boolean.toString(probe.getStorageService().isAuditLogEnabled()));
final AuditLogOptions options = probe.getAuditLogOptions();
tableBuilder.add("logger", options.logger.class_name);
tableBuilder.add("audit_logs_dir", options.audit_logs_dir);
tableBuilder.add("archive_command", options.archive_command);
tableBuilder.add("roll_cycle", options.roll_cycle);
tableBuilder.add("block", Boolean.toString(options.block));
tableBuilder.add("max_log_size", Long.toString(options.max_log_size));
tableBuilder.add("max_queue_weight", Integer.toString(options.max_queue_weight));
tableBuilder.add("max_archive_retries", Long.toString(options.max_archive_retries));
tableBuilder.add("included_keyspaces", options.included_keyspaces);
tableBuilder.add("excluded_keyspaces", options.excluded_keyspaces);
tableBuilder.add("included_categories", options.included_categories);
tableBuilder.add("excluded_categories", options.excluded_categories);
tableBuilder.add("included_users", options.included_users);
tableBuilder.add("excluded_users", options.excluded_users);
tableBuilder.printTo(probe.output().out);
}
use of org.apache.cassandra.audit.AuditLogOptions in project cassandra by apache.
the class SettingsTable method addAuditLoggingOptions.
private void addAuditLoggingOptions(SimpleDataSet result, Field f) {
Preconditions.checkArgument(AuditLogOptions.class.isAssignableFrom(f.getType()));
AuditLogOptions value = (AuditLogOptions) getValue(f);
result.row(f.getName() + "_enabled").column(VALUE, Boolean.toString(value.enabled));
result.row(f.getName() + "_logger").column(VALUE, value.logger.class_name);
result.row(f.getName() + "_audit_logs_dir").column(VALUE, value.audit_logs_dir);
result.row(f.getName() + "_included_keyspaces").column(VALUE, value.included_keyspaces);
result.row(f.getName() + "_excluded_keyspaces").column(VALUE, value.excluded_keyspaces);
result.row(f.getName() + "_included_categories").column(VALUE, value.included_categories);
result.row(f.getName() + "_excluded_categories").column(VALUE, value.excluded_categories);
result.row(f.getName() + "_included_users").column(VALUE, value.included_users);
result.row(f.getName() + "_excluded_users").column(VALUE, value.excluded_users);
}
Aggregations