# Distribution

The method used to distribute log data to the destination.

- Source: [`aws-logs/lib/log-group.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-logs/lib/log-group.ts#L622)
- Type last changed: v2.145.0 · 7 Jun 2024

## Example

```ts
import * as destinations from 'aws-cdk-lib/aws-logs-destinations';
import * as kinesis from 'aws-cdk-lib/aws-kinesis';

declare const stream: kinesis.Stream;
declare const logGroup: logs.LogGroup;

new logs.SubscriptionFilter(this, 'Subscription', {
  logGroup,
  destination: new destinations.KinesisDestination(stream),
  filterPattern: logs.FilterPattern.allTerms("ERROR", "MainThread"),
  filterName: 'ErrorInMainThread',
  distribution: logs.Distribution.RANDOM,
});
```

## Members

| Member | Description |
| --- | --- |
| `BY_LOG_STREAM` | Log events from the same log stream are kept together and sent to the same destination. |
| `RANDOM` | Log events are distributed across the log destinations randomly. |

## Referenced by

- [`SubscriptionFilterOptions`](/v2/docs/aws-cdk-lib.aws_logs.SubscriptionFilterOptions).distribution
