only bind the index audit trail if auditing is enabled
If auditing is not enabled, we should not bind the index audit trail as a lifecycle component since we do not bind all of its dependent classes when auditing is disabled. Original commit: elastic/x-pack-elasticsearch@39f736ca6a
This commit is contained in:
parent
95ad77a778
commit
f4ed6282fd
|
@ -30,7 +30,7 @@ public class AuditTrailModule extends AbstractShieldModule.Node implements PrePr
|
|||
|
||||
public AuditTrailModule(Settings settings) {
|
||||
super(settings);
|
||||
enabled = settings.getAsBoolean("shield.audit.enabled", false);
|
||||
enabled = auditingEnabled(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,11 +75,17 @@ public class AuditTrailModule extends AbstractShieldModule.Node implements PrePr
|
|||
}
|
||||
}
|
||||
|
||||
static boolean auditingEnabled(Settings settings) {
|
||||
return settings.getAsBoolean("shield.audit.enabled", false);
|
||||
}
|
||||
|
||||
public static boolean indexAuditLoggingEnabled(Settings settings) {
|
||||
String[] outputs = settings.getAsArray("shield.audit.outputs");
|
||||
for (String output : outputs) {
|
||||
if (output.equals(IndexAuditTrail.NAME)) {
|
||||
return true;
|
||||
if (auditingEnabled(settings)) {
|
||||
String[] outputs = settings.getAsArray("shield.audit.outputs");
|
||||
for (String output : outputs) {
|
||||
if (output.equals(IndexAuditTrail.NAME)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue