INTEGRITY Cloudflare Docs

Enable Elastic

Push your Cloudflare logs to Elastic for instant visibility and insights. Enabling this integration with Elastic comes with a predefined dashboard to view all of your Cloudflare observability and security data with ease.

The Cloudflare Logpush integration can be used in three different modes to collect data:

Enable Logpush Job in Cloudflare

Determine which method you want to use, and configure the appropriate Logpush job in the Cloudflare dashboard or via the API.

Elastic supports the default JSON format.

To push logs to an object storage for short term storage and buffering before ingesting into Elastic (recommended), follow the instructions to configure a Logpush job to push logs to AWS S3, Google Cloud Storage, or Azure Blob Storage.

To use the HTTP Endpoint mode, use the API to push logs to an HTTP endpoint backed by your Elastic Agent.

Add the same custom header along with its value on both sides for additional security.

For example, while creating a job along with a header and value for a particular dataset:

Required API token permissions

At least one of the following token permissions is required:
Create Logpush job
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/logpush/jobs" \
	--request POST \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"name": "<PUBLIC_DOMAIN>",
		"destination_conf": "https://<PUBLIC_DOMAIN>:<PUBLIC_PORT>?header_<SECRET_HEADER>=<SECRET_VALUE>",
		"dataset": "http_requests",
		"output_options": {
				"field_names": [
						"RayID",
						"EdgeStartTimestamp"
				],
				"timestamp_format": "rfc3339"
		}
	}'

Enable the Integration in Elastic

Once the Logpush job is configured, follow Elastics instructions for setting up the Integration in the Elastic app.

View Dashboards

Log in to your Elastic account to view prebuilt dashboards and configure alerts.