feat: Cloudformation + RDS
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
DeleteLogStreamCommand,
|
||||
DescribeLogGroupsCommand,
|
||||
DescribeLogStreamsCommand,
|
||||
FilterLogEventsCommand,
|
||||
GetLogEventsCommand,
|
||||
GetQueryResultsCommand,
|
||||
StartQueryCommand,
|
||||
@@ -25,6 +26,7 @@ import type {
|
||||
CreateResourceInput,
|
||||
LogsInsightsQueryInput,
|
||||
LogsInsightsQueryResult,
|
||||
LogsFilterInput,
|
||||
ResourceQuery,
|
||||
ServiceSchema,
|
||||
} from '../cloud-spi/types'
|
||||
@@ -150,6 +152,30 @@ export class AwsLogsAdapter implements CloudServiceAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
async filterLogEvents(logGroupName: string, input: LogsFilterInput, page: PageQuery = {}): Promise<CollectionPage<ChildItem>> {
|
||||
const response = await this.client.send(new FilterLogEventsCommand({
|
||||
logGroupName,
|
||||
filterPattern: input.filterPattern || undefined,
|
||||
logStreamNames: input.logStreamNames?.length ? input.logStreamNames : undefined,
|
||||
startTime: input.startTime,
|
||||
endTime: input.endTime,
|
||||
limit: page.limit,
|
||||
nextToken: page.cursor,
|
||||
}))
|
||||
return {
|
||||
items: (response.events ?? []).map((event, index) => ({
|
||||
id: event.eventId ?? `${event.logStreamName ?? ''}-${event.timestamp ?? 0}-${index}`,
|
||||
collectionId: event.logStreamName ?? null,
|
||||
timestamp: event.timestamp ? new Date(event.timestamp).toISOString() : null,
|
||||
body: {message: event.message ?? ''},
|
||||
metadata: {
|
||||
ingestionTime: event.ingestionTime ? new Date(event.ingestionTime).toISOString() : null,
|
||||
},
|
||||
})),
|
||||
nextCursor: response.nextToken ?? null,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DescribeLogGroups filters by prefix, so `/floci/probe` also returns
|
||||
* `/floci/probe-two`. Filtering to an exact match keeps `get` honest.
|
||||
|
||||
Reference in New Issue
Block a user