Skip to content

Commit 745ba6b

Browse files
albertzaharovitskcm
authored andcommitted
Rename and deprecated prefix logfile audit setting names (#34475)
The logfile audit log format is no longer formed by prefix fields followed by key value fields, it is all formed by key value fields only (JSON format). Consequently, the following settings, which toggled some of the prefix fields, have been renamed: audit.logfile .prefix.emit_node_host_address audit.logfile .prefix.emit_node_host_name audit.logfile .prefix.emit_node_name
1 parent c8dddbc commit 745ba6b

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/audit/logfile/LoggingAuditTrail.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,19 @@ public class LoggingAuditTrail extends AbstractComponent implements AuditTrail,
109109
public static final String OPAQUE_ID_FIELD_NAME = "opaque_id";
110110

111111
public static final String NAME = "logfile";
112-
public static final Setting<Boolean> EMIT_HOST_ADDRESS_SETTING = Setting
113-
.boolSetting(setting("audit.logfile.prefix.emit_node_host_address"), false, Property.NodeScope, Property.Dynamic);
114-
public static final Setting<Boolean> EMIT_HOST_NAME_SETTING = Setting.boolSetting(setting("audit.logfile.prefix.emit_node_host_name"),
115-
false, Property.NodeScope, Property.Dynamic);
116-
public static final Setting<Boolean> EMIT_NODE_NAME_SETTING = Setting.boolSetting(setting("audit.logfile.prefix.emit_node_name"), false,
117-
Property.NodeScope, Property.Dynamic);
118-
public static final Setting<Boolean> EMIT_NODE_ID_SETTING = Setting.boolSetting(setting("audit.logfile.prefix.emit_node_id"), true,
112+
public static final Setting<Boolean> DEPRECATED_EMIT_HOST_ADDRESS_SETTING = Setting.boolSetting(
113+
setting("audit.logfile.prefix.emit_node_host_address"), false, Property.NodeScope, Property.Dynamic, Property.Deprecated);
114+
public static final Setting<Boolean> EMIT_HOST_ADDRESS_SETTING = Setting.boolSetting(setting("audit.logfile.emit_node_host_address"),
115+
DEPRECATED_EMIT_HOST_ADDRESS_SETTING, Property.NodeScope, Property.Dynamic);
116+
public static final Setting<Boolean> DEPRECATED_EMIT_HOST_NAME_SETTING = Setting.boolSetting(
117+
setting("audit.logfile.prefix.emit_node_host_name"), false, Property.NodeScope, Property.Dynamic, Property.Deprecated);
118+
public static final Setting<Boolean> EMIT_HOST_NAME_SETTING = Setting.boolSetting(setting("audit.logfile.emit_node_host_name"),
119+
DEPRECATED_EMIT_HOST_NAME_SETTING, Property.NodeScope, Property.Dynamic);
120+
public static final Setting<Boolean> DEPRECATED_EMIT_NODE_NAME_SETTING = Setting
121+
.boolSetting(setting("audit.logfile.prefix.emit_node_name"), false, Property.NodeScope, Property.Dynamic, Property.Deprecated);
122+
public static final Setting<Boolean> EMIT_NODE_NAME_SETTING = Setting.boolSetting(setting("audit.logfile.emit_node_name"),
123+
DEPRECATED_EMIT_NODE_NAME_SETTING, Property.NodeScope, Property.Dynamic);
124+
public static final Setting<Boolean> EMIT_NODE_ID_SETTING = Setting.boolSetting(setting("audit.logfile.emit_node_id"), true,
119125
Property.NodeScope, Property.Dynamic);
120126
private static final List<String> DEFAULT_EVENT_INCLUDES = Arrays.asList(ACCESS_DENIED.toString(), ACCESS_GRANTED.toString(),
121127
ANONYMOUS_ACCESS_DENIED.toString(), AUTHENTICATION_FAILED.toString(), CONNECTION_DENIED.toString(), TAMPERED_REQUEST.toString(),

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/audit/logfile/LoggingAuditTrailFilterTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public class LoggingAuditTrailFilterTests extends ESTestCase {
6363
@Before
6464
public void init() throws Exception {
6565
settings = Settings.builder()
66-
.put("xpack.security.audit.logfile.prefix.emit_node_host_address", randomBoolean())
67-
.put("xpack.security.audit.logfile.prefix.emit_node_host_name", randomBoolean())
68-
.put("xpack.security.audit.logfile.prefix.emit_node_name", randomBoolean())
69-
.put("xpack.security.audit.logfile.events.emit_request_body", randomBoolean())
70-
.put("xpack.security.audit.logfile.events.include", "_all")
66+
.put(LoggingAuditTrail.EMIT_HOST_ADDRESS_SETTING.getKey(), randomBoolean())
67+
.put(LoggingAuditTrail.EMIT_HOST_NAME_SETTING.getKey(), randomBoolean())
68+
.put(LoggingAuditTrail.EMIT_NODE_NAME_SETTING.getKey(), randomBoolean())
69+
.put(LoggingAuditTrail.INCLUDE_REQUEST_BODY.getKey(), randomBoolean())
70+
.put(LoggingAuditTrail.INCLUDE_EVENT_SETTINGS.getKey(), "_all")
7171
.build();
7272
localNode = mock(DiscoveryNode.class);
7373
when(localNode.getHostAddress()).thenReturn(buildNewFakeTransportAddress().toString());

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/audit/logfile/LoggingAuditTrailTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ public static void releasePatternLayout() {
166166
public void init() throws Exception {
167167
includeRequestBody = randomBoolean();
168168
settings = Settings.builder()
169-
.put("xpack.security.audit.logfile.prefix.emit_node_host_address", randomBoolean())
170-
.put("xpack.security.audit.logfile.prefix.emit_node_host_name", randomBoolean())
171-
.put("xpack.security.audit.logfile.prefix.emit_node_name", randomBoolean())
169+
.put(LoggingAuditTrail.EMIT_HOST_ADDRESS_SETTING.getKey(), randomBoolean())
170+
.put(LoggingAuditTrail.EMIT_HOST_NAME_SETTING.getKey(), randomBoolean())
171+
.put(LoggingAuditTrail.EMIT_NODE_NAME_SETTING.getKey(), randomBoolean())
172+
.put(LoggingAuditTrail.EMIT_NODE_ID_SETTING.getKey(), randomBoolean())
172173
.put("xpack.security.audit.logfile.events.emit_request_body", includeRequestBody)
173174
.build();
174175
localNode = mock(DiscoveryNode.class);

0 commit comments

Comments
 (0)