101 lines
3.3 KiB
TypeScript
101 lines
3.3 KiB
TypeScript
import type { TargetBaseProps } from './util';
|
|
import * as events from '../../aws-events';
|
|
import { RuleTargetInput } from '../../aws-events';
|
|
import type * as logs from '../../aws-logs';
|
|
/**
|
|
* Options used when creating a target input template
|
|
*/
|
|
export interface LogGroupTargetInputOptions {
|
|
/**
|
|
* The timestamp that will appear in the CloudWatch Logs record
|
|
*
|
|
* @default EventField.time
|
|
*/
|
|
readonly timestamp?: any;
|
|
/**
|
|
* The value provided here will be used in the Log "message" field.
|
|
*
|
|
* This field must be a string. If an object is passed (e.g. JSON data)
|
|
* it will not throw an error, but the message that makes it to
|
|
* CloudWatch logs will be incorrect. This is a likely scenario if
|
|
* doing something like: EventField.fromPath('$.detail') since in most cases
|
|
* the `detail` field contains JSON data.
|
|
*
|
|
* @default EventField.detailType
|
|
*/
|
|
readonly message?: any;
|
|
}
|
|
/**
|
|
* The input to send to the CloudWatch LogGroup target
|
|
*/
|
|
export declare abstract class LogGroupTargetInput extends RuleTargetInput {
|
|
/**
|
|
* Pass a JSON object to the log group event target
|
|
*
|
|
* May contain strings returned by `EventField.from()` to substitute in parts of the
|
|
* matched event.
|
|
*
|
|
* @deprecated use fromObjectV2
|
|
*/
|
|
static fromObject(options: any): RuleTargetInput;
|
|
/**
|
|
* Pass a JSON object to the log group event target
|
|
*
|
|
* May contain strings returned by `EventField.from()` to substitute in parts of the
|
|
* matched event.
|
|
*/
|
|
static fromObjectV2(options?: LogGroupTargetInputOptions): LogGroupTargetInput;
|
|
}
|
|
/**
|
|
* Customize the CloudWatch LogGroup Event Target
|
|
*/
|
|
export interface LogGroupProps extends TargetBaseProps {
|
|
/**
|
|
* The event to send to the CloudWatch LogGroup
|
|
*
|
|
* This will be the event logged into the CloudWatch LogGroup
|
|
*
|
|
* @default - the entire EventBridge event
|
|
* @deprecated use logEvent instead
|
|
*/
|
|
readonly event?: events.RuleTargetInput;
|
|
/**
|
|
* The event to send to the CloudWatch LogGroup
|
|
*
|
|
* This will be the event logged into the CloudWatch LogGroup
|
|
*
|
|
* @default - the entire EventBridge event
|
|
*/
|
|
readonly logEvent?: LogGroupTargetInput;
|
|
/**
|
|
* Whether the custom resource created wll default to
|
|
* install latest AWS SDK
|
|
*
|
|
* @default - install latest AWS SDK
|
|
*/
|
|
readonly installLatestAwsSdk?: boolean;
|
|
}
|
|
/**
|
|
* Use an AWS CloudWatch LogGroup as an event rule target.
|
|
*/
|
|
export declare class CloudWatchLogGroup implements events.IRuleTarget {
|
|
private readonly logGroup;
|
|
private readonly props;
|
|
private target?;
|
|
constructor(logGroup: logs.ILogGroupRef, props?: LogGroupProps);
|
|
/**
|
|
* Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
|
|
*/
|
|
bind(rule: events.IRuleRef, _id?: string): events.RuleTargetConfig;
|
|
/**
|
|
* Validate that the target event input template has the correct format.
|
|
* The CloudWatchLogs target only supports a template with the format of:
|
|
* {"timestamp": <time>, "message": <message>}
|
|
*
|
|
* This is only needed if the deprecated `event` property is used.
|
|
*
|
|
* @see https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutTargets.html
|
|
*/
|
|
private validateInputTemplate;
|
|
}
|