-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAM] Add example log system action type (#175057)
## Summary <img width="449" alt="Screenshot 2024-01-17 at 11 29 36 AM" src="https://github.com/elastic/kibana/assets/1445834/f95aa7f0-54fa-4681-a1f7-1a9af19c884c"> <img width="493" alt="Screenshot 2024-01-17 at 11 29 32 AM" src="https://github.com/elastic/kibana/assets/1445834/44c7be21-b23b-4d7a-b9ea-66394a767abe"> This adds an example action type called System Log, which is enabled when running Kibana with the `--run-examples` flag. This action will log out to Kibana at the same rate as summarized alerts. **Please only refer to [29fa70d](29fa70d) when reviewing. Other code changes were cherry-picked from `main`** --------- Co-authored-by: Ying Mao <ying.mao@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
21f0a78
commit 299142c
Showing
62 changed files
with
1,271 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
packages/kbn-alerts-as-data-utils/src/schemas/generated/default_schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
// ---------------------------------- WARNING ---------------------------------- | ||
// this file was generated, and should not be edited by hand | ||
// ---------------------------------- WARNING ---------------------------------- | ||
import * as rt from 'io-ts'; | ||
import { Either } from 'fp-ts/lib/Either'; | ||
import { AlertSchema } from './alert_schema'; | ||
const ISO_DATE_PATTERN = /^d{4}-d{2}-d{2}Td{2}:d{2}:d{2}.d{3}Z$/; | ||
export const IsoDateString = new rt.Type<string, string, unknown>( | ||
'IsoDateString', | ||
rt.string.is, | ||
(input, context): Either<rt.Errors, string> => { | ||
if (typeof input === 'string' && ISO_DATE_PATTERN.test(input)) { | ||
return rt.success(input); | ||
} else { | ||
return rt.failure(input, context); | ||
} | ||
}, | ||
rt.identity | ||
); | ||
export type IsoDateStringC = typeof IsoDateString; | ||
export const schemaUnknown = rt.unknown; | ||
export const schemaUnknownArray = rt.array(rt.unknown); | ||
export const schemaString = rt.string; | ||
export const schemaStringArray = rt.array(schemaString); | ||
export const schemaNumber = rt.number; | ||
export const schemaNumberArray = rt.array(schemaNumber); | ||
export const schemaDate = rt.union([IsoDateString, schemaNumber]); | ||
export const schemaDateArray = rt.array(schemaDate); | ||
export const schemaDateRange = rt.partial({ | ||
gte: schemaDate, | ||
lte: schemaDate, | ||
}); | ||
export const schemaDateRangeArray = rt.array(schemaDateRange); | ||
export const schemaStringOrNumber = rt.union([schemaString, schemaNumber]); | ||
export const schemaStringOrNumberArray = rt.array(schemaStringOrNumber); | ||
export const schemaBoolean = rt.boolean; | ||
export const schemaBooleanArray = rt.array(schemaBoolean); | ||
const schemaGeoPointCoords = rt.type({ | ||
type: schemaString, | ||
coordinates: schemaNumberArray, | ||
}); | ||
const schemaGeoPointString = schemaString; | ||
const schemaGeoPointLatLon = rt.type({ | ||
lat: schemaNumber, | ||
lon: schemaNumber, | ||
}); | ||
const schemaGeoPointLocation = rt.type({ | ||
location: schemaNumberArray, | ||
}); | ||
const schemaGeoPointLocationString = rt.type({ | ||
location: schemaString, | ||
}); | ||
export const schemaGeoPoint = rt.union([ | ||
schemaGeoPointCoords, | ||
schemaGeoPointString, | ||
schemaGeoPointLatLon, | ||
schemaGeoPointLocation, | ||
schemaGeoPointLocationString, | ||
]); | ||
export const schemaGeoPointArray = rt.array(schemaGeoPoint); | ||
// prettier-ignore | ||
const DefaultAlertRequired = rt.type({ | ||
}); | ||
// prettier-ignore | ||
const DefaultAlertOptional = rt.partial({ | ||
}); | ||
|
||
// prettier-ignore | ||
export const DefaultAlertSchema = rt.intersection([DefaultAlertRequired, DefaultAlertOptional, AlertSchema]); | ||
// prettier-ignore | ||
export type DefaultAlert = rt.TypeOf<typeof DefaultAlertSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.