# LogGroupTargetInput

The input to send to the CloudWatch LogGroup target.

Extends: RuleTargetInput › LogGroupTargetInput

- Source: [`aws-events-targets/lib/log-group.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-events-targets/lib/log-group.ts#L41)
- Type last changed: v2.251.0 · 24 Apr 2026

## Example

```ts
import * as logs from 'aws-cdk-lib/aws-logs';
declare const logGroup: logs.LogGroup;
declare const rule: events.Rule;

rule.addTarget(new targets.CloudWatchLogGroup(logGroup, {
  logEvent: targets.LogGroupTargetInput.fromObjectV2({
    timestamp: events.EventField.fromPath('$.time'),
    message: events.EventField.fromPath('$.detail-type'),
  }),
}));
```

## Initializer

```ts
new LogGroupTargetInput()
```

## Methods

- `bind(rule: IRuleRef): RuleTargetInputProperties` — Return the input properties for this input object.

- `fromEventPath(path: string): RuleTargetInput` (static) — Take the event target input from a path in the event JSON.

  This emits CloudFormation's `InputPath` directly, so the target receives only
  the selected fragment of the event. Use this when you want to forward part of
  the event unchanged; use `fromObject()` when you need to reshape it.

- `fromMultilineText(text: string): RuleTargetInput` (static) — Pass text to the event target, splitting on newlines.

  This is only useful when passing to a target that does not
  take a single argument.

  May contain strings returned by `EventField.from()` to substitute in parts
  of the matched event.

  As with `fromText`, each line is JSON-encoded, so every line is wrapped in
  double quotes in the synthesized template. Whether those quotes are visible
  to the recipient depends on the target service.

- `fromObject(options: any): RuleTargetInput` (static) — use fromObjectV2

  May contain strings returned by `EventField.from()` to substitute in parts of the
  matched event.

- `fromObjectV2(options?: LogGroupTargetInputOptions): LogGroupTargetInput // chainable` (static) — 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.

- `fromText(text: string): RuleTargetInput` (static) — Pass text to the event target.

  May contain strings returned by `EventField.from()` to substitute in parts of the
  matched event.

  The Rule Target input value will be a single string: the string you pass
  here.  Do not use this method to pass a complex value like a JSON object to
  a Rule Target.  Use `RuleTargetInput.fromObject()` instead.

  The target `Input` field must be valid JSON, so the text is JSON-encoded
  when the template is synthesized. As a result a plain string is wrapped in
  double quotes: `fromText('something')` renders as `Input: '"something"'`.
  The quotes are part of the required JSON encoding, not an extra value added
  by CDK, and cannot be removed.

  Whether those quotes are visible to the recipient depends on the target
  service. Some targets deliver the JSON-encoded value as-is, so the recipient
  sees the surrounding quotes (for example, an SNS topic delivering to an
  email subscriber shows `"something"`). To send a structured payload, use
  `RuleTargetInput.fromObject()` instead.
