Skip to content

Commit

Permalink
[Fleet] add leading dot to hidden indices (#86277)
Browse files Browse the repository at this point in the history

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: John Schulz <github.com@jfsiii.org>
  • Loading branch information
3 people authored Jan 4, 2021
1 parent 4c3c2ac commit 5e5a410
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
11 changes: 10 additions & 1 deletion x-pack/plugins/fleet/server/services/api_keys/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ export async function generateOutputApiKey(
cluster: ['monitor'],
index: [
{
names: ['logs-*', 'metrics-*', 'traces-*', '.ds-logs-*', '.ds-metrics-*', '.ds-traces-*'],
names: [
'logs-*',
'metrics-*',
'traces-*',
'.ds-logs-*',
'.ds-metrics-*',
'.ds-traces-*',
'.logs-endpoint.diagnostic.collection-*',
'.ds-.logs-endpoint.diagnostic.collection-*',
],
privileges: ['write', 'create_index', 'indices:admin/auto_create'],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@ test('getBaseName', () => {
const name = getRegistryDataStreamAssetBaseName(dataStream);
expect(name).toStrictEqual('logs-nginx.access');
});

test('getBaseName for hidden index', () => {
const dataStream: RegistryDataStream = {
dataset: 'nginx.access',
title: 'Nginx Acess Logs',
release: 'beta',
type: 'logs',
ingest_pipeline: 'default',
package: 'nginx',
path: 'access',
hidden: true,
};
const name = getRegistryDataStreamAssetBaseName(dataStream);
expect(name).toStrictEqual('.logs-nginx.access');
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ import { RegistryDataStream } from '../../../types';
* {type}-{dataset}
*/
export function getRegistryDataStreamAssetBaseName(dataStream: RegistryDataStream): string {
return `${dataStream.type}-${dataStream.dataset}`;
const baseName = `${dataStream.type}-${dataStream.dataset}`;
return dataStream.hidden ? `.${baseName}` : baseName;
}
11 changes: 10 additions & 1 deletion x-pack/plugins/fleet/server/services/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,16 @@ export async function setupFleet(
cluster: ['monitor', 'manage_api_key'],
indices: [
{
names: ['logs-*', 'metrics-*', 'traces-*', '.ds-logs-*', '.ds-metrics-*', '.ds-traces-*'],
names: [
'logs-*',
'metrics-*',
'traces-*',
'.ds-logs-*',
'.ds-metrics-*',
'.ds-traces-*',
'.logs-endpoint.diagnostic.collection-*',
'.ds-.logs-endpoint.diagnostic.collection-*',
],
privileges: ['write', 'create_index', 'indices:admin/auto_create'],
},
],
Expand Down
2 changes: 2 additions & 0 deletions x-pack/test/fleet_api_integration/apis/agents_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export default function (providerContext: FtrProviderContext) {
'.ds-logs-*',
'.ds-metrics-*',
'.ds-traces-*',
'.logs-endpoint.diagnostic.collection-*',
'.ds-.logs-endpoint.diagnostic.collection-*',
],
privileges: ['write', 'create_index', 'indices:admin/auto_create'],
allow_restricted_indices: false,
Expand Down

0 comments on commit 5e5a410

Please sign in to comment.