Skip to content

Commit

Permalink
Renamed ilm policy for event log so it is not prefixed with dot (elas…
Browse files Browse the repository at this point in the history
…tic#64262)

* Renamed ilm policy for event log so it is not prefixed with dot

* Fixed due to comments
  • Loading branch information
YulNaumenko committed Apr 24, 2020
1 parent ee158cc commit 0b2126f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/event_log/server/es/names.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const createNamesMock = () => {
const mock: jest.Mocked<EsNames> = {
base: '.kibana',
alias: '.kibana-event-log-8.0.0',
ilmPolicy: '.kibana-event-log-policy',
ilmPolicy: 'kibana-event-log-policy',
indexPattern: '.kibana-event-log-*',
indexPatternWithVersion: '.kibana-event-log-8.0.0-*',
initialIndex: '.kibana-event-log-8.0.0-000001',
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/event_log/server/es/names.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ describe('getEsNames()', () => {
expect(esNames.initialIndex).toEqual(`${base}-event-log-${version}-000001`);
expect(esNames.indexTemplate).toEqual(`${base}-event-log-${version}-template`);
});

test('ilm policy name does not contain dot prefix', () => {
const base = '.XYZ';
const esNames = getEsNames(base);
expect(esNames.ilmPolicy).toEqual('XYZ-event-log-policy');
});
});
5 changes: 4 additions & 1 deletion x-pack/plugins/event_log/server/es/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ export interface EsNames {
export function getEsNames(baseName: string): EsNames {
const eventLogName = `${baseName}${EVENT_LOG_NAME_SUFFIX}`;
const eventLogNameWithVersion = `${eventLogName}${EVENT_LOG_VERSION_SUFFIX}`;
const eventLogPolicyName = `${
baseName.startsWith('.') ? baseName.substring(1) : baseName
}${EVENT_LOG_NAME_SUFFIX}-policy`;
return {
base: baseName,
alias: eventLogNameWithVersion,
ilmPolicy: `${eventLogName}-policy`,
ilmPolicy: `${eventLogPolicyName}`,
indexPattern: `${eventLogName}-*`,
indexPatternWithVersion: `${eventLogNameWithVersion}-*`,
initialIndex: `${eventLogNameWithVersion}-000001`,
Expand Down

0 comments on commit 0b2126f

Please sign in to comment.