Skip to content

Commit

Permalink
Correct system index names in Kibana module (elastic#63950)
Browse files Browse the repository at this point in the history
This commit updates the list of system index names to be complete and
correct for Kibana and APM. The pattern `.kibana*` is too inclusive for
system indices and actually includes the
`.kibana-event-log-${version}-${int}` pattern for the Kibana event log,
which should only be hidden and not a system index. Additionally, the
`.apm-custom-link` index was not included in the list of system
indices. Finally, the reporting pattern has been updated to match that
of the permissions given to the kibana_system role.
  • Loading branch information
jaymode authored Oct 21, 2020
1 parent ff736f0 commit f47fedd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ public KibanaSystemIndexIT(@Name("indexName") String indexName) {
public static Iterable<Object[]> data() {
return Arrays.asList(
new Object[] { ".kibana" },
new Object[] { ".kibana-1" },
new Object[] { ".reporting" },
new Object[] { ".apm-agent-configuration" }
new Object[] { ".kibana_1" },
new Object[] { ".reporting-1" },
new Object[] { ".apm-agent-configuration" },
new Object[] { ".apm-custom-link" }
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin {

public static final Setting<List<String>> KIBANA_INDEX_NAMES_SETTING = Setting.listSetting(
"kibana.system_indices",
List.of(".kibana*", ".reporting", ".apm-agent-configuration"),
List.of(".kibana", ".kibana_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link"),
Function.identity(),
Property.NodeScope
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,20 @@ public void testKibanaIndexNames() {
.stream()
.map(SystemIndexDescriptor::getIndexPattern)
.collect(Collectors.toUnmodifiableList()),
contains(".kibana*", ".reporting", ".apm-agent-configuration")
contains(".kibana", ".kibana_*", ".reporting-*", ".apm-agent-configuration", ".apm-custom-link")
);
final List<String> names = List.of("." + randomAlphaOfLength(4), "." + randomAlphaOfLength(6));

final List<String> names = List.of("." + randomAlphaOfLength(4), "." + randomAlphaOfLength(5));
final List<String> namesFromDescriptors = new KibanaPlugin().getSystemIndexDescriptors(
Settings.builder().putList(KibanaPlugin.KIBANA_INDEX_NAMES_SETTING.getKey(), names).build()
).stream().map(SystemIndexDescriptor::getIndexPattern).collect(Collectors.toUnmodifiableList());
assertThat(namesFromDescriptors, is(names));

assertThat(
new KibanaPlugin().getSystemIndexDescriptors(Settings.EMPTY)
.stream()
.anyMatch(systemIndexDescriptor -> systemIndexDescriptor.matchesIndexPattern(".kibana-event-log-7-1")),
is(false)
);
}
}

0 comments on commit f47fedd

Please sign in to comment.