-
Notifications
You must be signed in to change notification settings - Fork 9.9k
[Logs] Add Kinesis as destination #25325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
src/content/docs/logs/logpush/logpush-job/enable-destinations/kinesis.mdx
This file contains hidden or 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,90 @@ | ||
| --- | ||
| pcx_content_type: how-to | ||
| title: Enable Amazon Kinesis | ||
| sidebar: | ||
| order: 98 | ||
| --- | ||
|
|
||
| Logpush supports [Amazon Kinesis](https://aws.amazon.com/kinesis/) as a destination for all datasets. Each Kinesis record that Logpush sends will contain a batch of GZIP-compressed data in newline-delimited JSON format (by default), or in the format specified in the [`output_options`](/logs/logpush/logpush-job/log-output-options/) parameter when the job was created. | ||
|
|
||
| ## Configure Kinesis using STS Assume Role (recommended) | ||
|
|
||
| 1. Create an IAM Role for Cloudflare Logpush to Assume with the following trust relationship: | ||
|
|
||
| ```java | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Effect": "Allow", | ||
| "Principal": { | ||
| "AWS": [ | ||
| "arn:aws:iam::391854517948:user/cloudflare-logpush" | ||
| ] | ||
| }, | ||
| "Action": "sts:AssumeRole" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| 2. Ensure that the IAM role has permissions to perform the `PutRecord` action on your Kinesis stream. Replace `<AWS_REGION>`, `<YOUR_AWS_ACCOUNT_ID>` and `<STREAM_NAME>` with your own values. | ||
|
|
||
| ```java | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Effect": "Allow", | ||
| "Action": "kinesis:PutRecord", | ||
| "Resource": "arn:aws:kinesis:<AWS_REGION>:<YOUR_AWS_ACCOUNT_ID>:stream/<STREAM_NAME>" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| 3. Create a Logpush job, using the following format for the `destination_conf` field. | ||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| kinesis://<STEAM_NAME>?region=<AWS_REGION>&sts-assume-role-arn=arn:aws:iam::<YOUR_AWS_ACCOUNT_NUMBER>:role/<IAM_ROLE_NAME> | ||
| ``` | ||
|
|
||
| 4. (optional) When using STS Assume Role, you can include `sts-external-id` as a `destination_conf` parameter so it is included in your Logpush job's requests to Kinesis. Refer to [Securely Using External ID for Accessing AWS Accounts Owned by Others](https://aws.amazon.com/blogs/apn/securely-using-external-id-for-accessing-aws-accounts-owned-by-others/) for more information. | ||
|
|
||
| ```bash | ||
| kinesis://<STEAM_NAME>?region=<AWS_REGION>&sts-assume-role-arn=arn:aws:iam::<YOUR_AWS_ACCOUNT_NUMBER>:role/<IAM_ROLE_NAME>&sts-external-id=<EXTERNAL_ID> | ||
| ``` | ||
|
|
||
| ### STS Assume Role example | ||
|
|
||
| ```bash | ||
| $ curl https://api.cloudflare.com/client/v4/zones/$ZONE_TAG/logpush/jobs \ | ||
| -H 'Authorization: Bearer <API_TOKEN>' \ | ||
| -H 'Content-Type: application/json' -d '{ | ||
| "name": "kinesis", | ||
| "destination_conf": "kinesis://<STEAM_NAME>?region=<AWS_REGION>&sts-assume-role-arn=arn:aws:iam::<YOUR_AWS_ACCOUNT_NUMBER>:role/<IAM_ROLE_NAME>", | ||
| "dataset": "http_requests", | ||
| "enabled": true | ||
| }' | ||
| ``` | ||
|
|
||
| ## Configure Kinesis using IAM Access Keys | ||
|
|
||
| When configuring your Logpush job using IAM Access Keys, ensure that the IAM user has permission to perform the `PutRecord` action on your Kinesis stream. | ||
angelampcosta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| kinesis://<STREAM_NAME>?region=<AWS_REGION>&access-key-id=<AWS_ACCESS_KEY_ID>&secret-access-key=<AWS_SECRET_ACCESS_KEY> | ||
| ``` | ||
|
|
||
| ### IAM Access Key example | ||
|
|
||
| ```bash | ||
| $ curl https://api.cloudflare.com/client/v4/zones/$ZONE_TAG/logpush/jobs \ | ||
| -H 'Authorization: Bearer <API_TOKEN>' \ | ||
| -H 'Content-Type: application/json' -d '{ | ||
| "name": "kinesis", | ||
| "destination_conf": "kinesis://<STREAM_NAME>?region=<AWS_REGION>&access-key-id=<AWS_ACCESS_KEY_ID>&secret-access-key=<AWS_SECRET_ACCESS_KEY>", | ||
| "dataset": "http_requests", | ||
| "enabled": true | ||
| }' | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.