Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ export const RuleMigration = z
* The rule migration id
*/
id: NonEmptyString,
/**
* The rule migration name
*/
name: NonEmptyString,
})
.merge(RuleMigrationData);

Expand Down Expand Up @@ -324,6 +328,10 @@ export const RuleMigrationTaskStats = z.object({
* The migration id
*/
id: NonEmptyString,
/**
* The migration name
*/
name: NonEmptyString,
/**
* Indicates if the migration task status.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ components:
- type: object
required:
- id
- name
properties:
id:
description: The rule migration id
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
name:
description: The rule migration name
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
- $ref: '#/components/schemas/RuleMigrationData'

RuleMigrationData:
Expand Down Expand Up @@ -205,6 +209,7 @@ components:
description: The rule migration task stats object.
required:
- id
- name
- status
- rules
- created_at
Expand All @@ -213,6 +218,9 @@ components:
id:
description: The migration id
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
name:
description: The migration name
$ref: '../../../common/api/model/primitives.schema.yaml#/components/schemas/NonEmptyString'
status:
description: Indicates if the migration task status.
$ref: '#/components/schemas/RuleMigrationTaskStatus'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ export interface RuleMigrationFilters {
partiallyTranslated?: boolean;
untranslatable?: boolean;
searchTerm?: string;
name?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const mockMigrationStateWithError = {
last_error:
'Failed to populate ELSER indices. Make sure the ELSER model is deployed and running at Machine Learning > Trained Models. Error: Exception when running inference id [.elser-2-elasticsearch] on field [elser_embedding]',
id: 'c44d2c7d-0de1-4231-8b82-0dcfd67a9fe3',
name: 'Migration 1',
rules: { total: 6, pending: 6, processing: 0, completed: 0, failed: 0 },
created_at: '2025-05-27T12:12:17.563Z',
last_updated_at: '2025-05-27T12:12:17.563Z',
Expand All @@ -49,6 +50,7 @@ const mockMigrationStateWithError = {
const mockMigrationStatsAborted = {
status: SiemMigrationTaskStatus.ABORTED,
id: 'c44d2c7d-0de1-4231-8b82-0dcfd67a9fe3',
name: 'Migration 1',
rules: { total: 6, pending: 6, processing: 0, completed: 0, failed: 0 },
created_at: '2025-05-27T12:12:17.563Z',
last_updated_at: '2025-05-27T12:12:17.563Z',
Expand All @@ -58,6 +60,7 @@ const mockMigrationStatsAborted = {
const mockMigrationStatsReady = {
status: SiemMigrationTaskStatus.READY,
id: 'c44d2c7d-0de1-4231-8b82-0dcfd67a9fe3',
name: 'Migration 1',
rules: { total: 6, pending: 6, processing: 0, completed: 0, failed: 0 },
created_at: '2025-05-27T12:12:17.563Z',
last_updated_at: '2025-05-27T12:12:17.563Z',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import type { SiemMigrationTaskStatus } from '../../../common/siem_migrations/co
import type { RuleMigrationTaskStats } from '../../../common/siem_migrations/model/rule_migration.gen';

export interface RuleMigrationStats extends RuleMigrationTaskStats {
status: SiemMigrationTaskStatus;
/** The sequential number of the migration */
number: number;
/** The name of the migration */
name?: string;
status: SiemMigrationTaskStatus; // use the native enum instead of the zod enum from the model
}

export enum AuthorFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type AddRuleMigrationRulesInput = Omit<
RuleMigrationRule,
'@timestamp' | 'id' | 'status' | 'created_by'
>;
export type RuleMigrationDataStats = Omit<RuleMigrationTaskStats, 'status'>;
export type RuleMigrationDataStats = Omit<RuleMigrationTaskStats, 'name' | 'status'>;
export type RuleMigrationAllDataStats = RuleMigrationDataStats[];

export interface RuleMigrationGetRulesOptions {
Expand Down Expand Up @@ -451,9 +451,6 @@ export class RuleMigrationsDataRulesClient extends RuleMigrationsDataBaseClient
} else if (filters.untranslatable === false) {
filter.push(searchConditions.isNotUntranslatable());
}
if (filters.name) {
filter.push({ term: { name: filters.name } });
}
return { bool: { filter } };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const getPrebuiltRulesFieldMap: ({
export const migrationsFieldMaps: FieldMap<
SchemaFieldMapKeys<Omit<RuleMigration, 'id' | 'last_execution'>>
> = {
name: { type: 'keyword', required: true },
created_at: { type: 'date', required: true },
created_by: { type: 'keyword', required: true },
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export class RuleMigrationIndexMigrator {
async run() {
const allSpaces = await this.getSpaceListForMigrations();
if (allSpaces.length === 0) {
this.logger.info('No spaces or index found for index migration');
this.logger.debug('No spaces or index found for index migration');
return;
}
this.logger.info(
this.logger.debug(
`Starting index migration for rule migrations for spaces :${allSpaces.join(', ')}`
);
for (const spaceId of allSpaces) {
Expand All @@ -48,6 +48,6 @@ export class RuleMigrationIndexMigrator {
);
await migrator.run();
}
this.logger.info('Finished index migration for rule migrations successfully');
this.logger.debug('Finished index migration for rule migrations successfully');
}
}
Loading
Loading