Logpush supports Amazon 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 parameter when the job was created.
- Create an IAM Role for Cloudflare Logpush to Assume with the following trust relationship:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::391854517948:user/cloudflare-logpush"
]
},
"Action": "sts:AssumeRole"
}
]
}- Ensure that the IAM role has permissions to perform the
PutRecordaction on your Kinesis stream. Replace<AWS_REGION>,<YOUR_AWS_ACCOUNT_ID>and<STREAM_NAME>with your own values:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "kinesis:PutRecord",
"Resource": "arn:aws:kinesis:<AWS_REGION>:<YOUR_AWS_ACCOUNT_ID>:stream/<STREAM_NAME>"
}
]
}- Create a Logpush job, using the following format for the
destination_conffield:
kinesis://<STREAM_NAME>?region=<AWS_REGION>&sts-assume-role-arn=arn:aws:iam::<YOUR_AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>- (optional) When using STS Assume Role, you can include
sts-external-idas adestination_confparameter 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 ↗ for more information.
kinesis://<STREAM_NAME>?region=<AWS_REGION>&sts-assume-role-arn=arn:aws:iam::<YOUR_AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>&sts-external-id=<EXTERNAL_ID>$ 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>&sts-assume-role-arn=arn:aws:iam::<YOUR_AWS_ACCOUNT_ID>:role/<IAM_ROLE_NAME>",
"dataset": "http_requests",
"enabled": true
}'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:
kinesis://<STREAM_NAME>?region=<AWS_REGION>&access-key-id=<AWS_ACCESS_KEY_ID>&secret-access-key=<AWS_SECRET_ACCESS_KEY>$ 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
}'