Skip to content

Commit 134cd00

Browse files
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 by splicing out the prefix component: - xpack.security.audit.logfile.prefix.emit_node_host_address - xpack.security.audit.logfile.prefix.emit_node_host_name - xpack.security.audit.logfile.prefix.emit_node_name
1 parent c666ba0 commit 134cd00

File tree

4 files changed

+44
-15
lines changed

4 files changed

+44
-15
lines changed

docs/reference/migration/migrate_6_5.asciidoc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,25 @@ type of `Set<RoleDescriptor>`, but in 6.5.0 the role provider requires an
8181
`RoleRetrievalResult` object accepts a `Set<RoleDescriptor>` if the provider
8282
was successful; if the provider was not successful the `RoleRetrievalResult`
8383
should be populated with the error.
84+
85+
[float]
86+
[[breaking_65_settings_changes]]
87+
=== Settings changes
88+
89+
[float]
90+
==== Audit logfile local node info
91+
92+
In 6.5.0 a new format for the logfile auditing has been introduced.
93+
The new file format prints audit entries as JSON documents.
94+
Entries in the previous format contained positional fields.
95+
These fields are no longer positional in the new format, as they are part of the
96+
structured log entry (the JSON document).
97+
Consequently, the following settings, which toggled some of the prefix
98+
positional fields, have be renamed ("prefix" was spliced out):
99+
- `xpack.security.audit.logfile.prefix.emit_node_host_address` to
100+
`xpack.security.audit.logfile.emit_node_host_address`
101+
- `xpack.security.audit.logfile.prefix.emit_node_host_name` to
102+
`xpack.security.audit.logfile.emit_node_host_name`
103+
- `xpack.security.audit.logfile.prefix.emit_node_name` to
104+
`xpack.security.audit.logfile.emit_node_name`
105+
In 7.0.0 the `prefix` variant will be removed.

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
@@ -110,13 +110,19 @@ public class LoggingAuditTrail extends AbstractComponent implements AuditTrail,
110110
public static final String OPAQUE_ID_FIELD_NAME = "opaque_id";
111111

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