[Reporting] Breaking: Remove setting for Reporting index (#113803)

This commit is contained in:
Tim Sullivan 2021-10-05 11:21:47 -07:00 committed by GitHub
parent 35200bea1f
commit e55593f2ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 8 additions and 91 deletions

View file

@ -11,7 +11,6 @@ You can configure `xpack.reporting` settings in your `kibana.yml` to:
* <<general-reporting-settings,Enable the {report-features}>>
* <<encryption-keys,Configure the encryption key>>
* <<report-indices,Configure the reporting index>>
* <<reporting-kibana-server-settings,Control how the {report-features} communicate with the {kib} server>>
* <<reporting-job-queue-settings,Manage background jobs>>
* <<reporting-capture-settings,Capture screenshots>>
@ -47,33 +46,6 @@ The static encryption key for reporting. Use an alphanumeric text string that is
xpack.reporting.encryptionKey: "something_secret"
--------------------------------------------------------------------------------
[float]
[[report-indices]]
==== Reporting index setting
`xpack.reporting.index`::
deprecated:[7.11.0,This setting will be removed in 8.0.0.] Multitenancy by changing `kibana.index` is unsupported starting in 8.0.0. For more details, refer to https://ela.st/kbn-remove-legacy-multitenancy[8.0 Breaking Changes]. When you divide workspaces in an Elastic cluster using multiple {kib} instances with a different `kibana.index` setting per instance, you must set a unique `xpack.reporting.index` setting per `kibana.index`. Otherwise, report generation periodically fails if a report is queued through an instance with one `kibana.index` setting, and an instance with a different `kibana.index` attempts to claim the job. Reporting uses a weekly index in {es} to store the reporting job and the report content. The index is automatically created if it does not already exist. Configure a unique value for `xpack.reporting.index`, beginning with `.reporting-`, for every {kib} instance that has a unique <<kibana-index, `kibana.index`>> setting. Defaults to `.reporting`.
{kib} instance A:
[source,yaml]
--------------------------------------------------------------------------------
kibana.index: ".kibana-a"
xpack.reporting.index: ".reporting-a"
xpack.reporting.encryptionKey: "something_secret"
--------------------------------------------------------------------------------
{kib} instance B:
[source,yaml]
--------------------------------------------------------------------------------
kibana.index: ".kibana-b"
xpack.reporting.index: ".reporting-b"
xpack.reporting.encryptionKey: "something_secret"
--------------------------------------------------------------------------------
NOTE: If security is enabled, the `xpack.reporting.index` setting should begin with `.reporting-` for the `kibana_system` role to have the necessary privileges over the index.
[float]
[[reporting-kibana-server-settings]]
==== {kib} server settings

View file

@ -148,56 +148,6 @@ reporting_user:
- "cn=Bill Murray,dc=example,dc=com"
--------------------------------------------------------------------------------
[float]
==== Grant access with a custom index
If you are using a custom index, the `xpack.reporting.index` setting must begin with `.reporting-*`. The default {kib} system user has `all` privileges against the `.reporting-*` pattern of indices.
If you use a different pattern for the `xpack.reporting.index` setting, you must create a custom `kibana_system` user with appropriate access to the index.
NOTE: In the next major version of Kibana, granting access with a custom index is unsupported.
. Create the reporting role.
.. Open the main menu, then click *Stack Management*.
.. Click *Roles > Create role*.
. Specify the role settings.
.. Enter the *Role name*. For example, `custom-reporting-user`.
.. From the *Indices* dropdown, select the custom index.
.. From the *Privileges* dropdown, select *all*.
.. Click *Add Kibana privilege*.
.. Select one or more *Spaces* that you want to grant reporting privileges to.
.. Click *Customize*, then click *Analytics*.
.. Next to each application you want to grant reporting privileges to, click *All*.
.. Click *Add {kib} privilege*, then click *Create role*.
. Assign the reporting role to a user.
.. Open the main menu, then click *Stack Management*.
.. Click *Users*, then click the user you want to assign the reporting role to.
.. From the *Roles* dropdown, select *kibana_system* and *custom-reporting-user*.
.. Click *Update user*.
. Configure {kib} to use the new account.
+
[source,js]
--------------------------------------------------------------------------------
elasticsearch.username: 'custom_kibana_system'
--------------------------------------------------------------------------------
[float]
[[securing-reporting]]
=== Secure the reporting endpoints

View file

@ -319,7 +319,6 @@ kibana_vars=(
xpack.reporting.csv.useByteOrderMarkEncoding
xpack.reporting.enabled
xpack.reporting.encryptionKey
xpack.reporting.index
xpack.reporting.kibanaApp
xpack.reporting.kibanaServer.hostname
xpack.reporting.kibanaServer.port

View file

@ -7,6 +7,8 @@
export const PLUGIN_ID = 'reporting';
export const REPORTING_SYSTEM_INDEX = '.reporting';
export const JOB_COMPLETION_NOTIFICATIONS_SESSION_KEY =
'xpack.reporting.jobCompletionNotifications';

View file

@ -84,7 +84,6 @@ describe('Reporting Config Schema', () => {
},
"enabled": true,
"encryptionKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"index": ".reporting",
"kibanaServer": Object {},
"poll": Object {
"jobCompletionNotifier": Object {
@ -189,7 +188,6 @@ describe('Reporting Config Schema', () => {
"useByteOrderMarkEncoding": false,
},
"enabled": true,
"index": ".reporting",
"kibanaServer": Object {},
"poll": Object {
"jobCompletionNotifier": Object {

View file

@ -155,8 +155,6 @@ const RolesSchema = schema.object({
allow: schema.arrayOf(schema.string(), { defaultValue: ['reporting_user'] }),
});
const IndexSchema = schema.string({ defaultValue: '.reporting' });
// Browser side polling: job completion notifier, management table auto-refresh
// NOTE: can not use schema.duration, a bug prevents it being passed to the browser correctly
const PollSchema = schema.object({
@ -178,7 +176,6 @@ export const ConfigSchema = schema.object({
csv: CsvSchema,
encryptionKey: EncryptionKeySchema,
roles: RolesSchema,
index: IndexSchema,
poll: PollSchema,
});

View file

@ -77,7 +77,6 @@ describe('CSV Execute Job', function () {
stream = { write: jest.fn((chunk) => (content += chunk)) } as unknown as typeof stream;
configGetStub = sinon.stub();
configGetStub.withArgs('queue', 'timeout').returns(moment.duration('2m'));
configGetStub.withArgs('index').returns('.reporting-foo-test');
configGetStub.withArgs('encryptionKey').returns(encryptionKey);
configGetStub.withArgs('csv', 'maxSizeBytes').returns(1024 * 1000); // 1mB
configGetStub.withArgs('csv', 'scroll').returns({});

View file

@ -9,7 +9,7 @@ import { IndexResponse, UpdateResponse } from '@elastic/elasticsearch/api/types'
import { ElasticsearchClient } from 'src/core/server';
import { LevelLogger, statuses } from '../';
import { ReportingCore } from '../../';
import { ILM_POLICY_NAME } from '../../../common/constants';
import { ILM_POLICY_NAME, REPORTING_SYSTEM_INDEX } from '../../../common/constants';
import { JobStatus, ReportOutput, ReportSource } from '../../../common/types';
import { ReportTaskParams } from '../tasks';
import { Report, ReportDocument, SavedReport } from './';
@ -87,7 +87,7 @@ export class ReportingStore {
constructor(private reportingCore: ReportingCore, private logger: LevelLogger) {
const config = reportingCore.getConfig();
this.indexPrefix = config.get('index');
this.indexPrefix = REPORTING_SYSTEM_INDEX;
this.indexInterval = config.get('queue', 'indexInterval');
this.logger = logger.clone(['store']);
}

View file

@ -13,6 +13,7 @@ import { UnwrapPromise } from '@kbn/utility-types';
import { ElasticsearchClient } from 'src/core/server';
import { PromiseType } from 'utility-types';
import { ReportingCore } from '../../';
import { REPORTING_SYSTEM_INDEX } from '../../../common/constants';
import { ReportApiJSON, ReportSource } from '../../../common/types';
import { statuses } from '../../lib/statuses';
import { Report } from '../../lib/store';
@ -54,9 +55,7 @@ interface JobsQueryFactory {
export function jobsQueryFactory(reportingCore: ReportingCore): JobsQueryFactory {
function getIndex() {
const config = reportingCore.getConfig();
return `${config.get('index')}-*`;
return `${REPORTING_SYSTEM_INDEX}-*`;
}
async function execQuery<

View file

@ -8,6 +8,7 @@ import type { estypes } from '@elastic/elasticsearch';
import type { ElasticsearchClient } from 'kibana/server';
import { get } from 'lodash';
import type { ReportingConfig } from '../';
import { REPORTING_SYSTEM_INDEX } from '../../common/constants';
import type { ExportTypesRegistry } from '../lib/export_types_registry';
import type { GetLicense } from './';
import { getExportStats } from './get_export_stats';
@ -144,7 +145,7 @@ export async function getReportingUsage(
esClient: ElasticsearchClient,
exportTypesRegistry: ExportTypesRegistry
): Promise<ReportingUsageType> {
const reportingIndex = config.get('index');
const reportingIndex = REPORTING_SYSTEM_INDEX;
const params = {
index: `${reportingIndex}-*`,
filterPath: 'aggregations.*.buckets',