# Pro tip: Configure Cloudflare Logpush to Dynatrace

**URL:** <https://community.dynatrace.com/t/pro-tip-configure-cloudflare-logpush-to-dynatrace/44067>\
**Category:** Dynatrace Tips\
**Tags:** log-configuration\
**Created:** [February 9, 2024, 8:56pm UTC](https://community.dynatrace.com/t/pro-tip-configure-cloudflare-logpush-to-dynatrace/44067 "2024-02-09T20:56:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [February 9, 2024, 8:56pm UTC](https://community.dynatrace.com/t/pro-tip-configure-cloudflare-logpush-to-dynatrace/44067/1 "2024-02-09T20:56:06Z")

</div>

If you have a Cloudflare Enterprise plan, you can push logs from Cloudflare directly into Dynatrace.

To do that, you need the following data:

- $ZONE\_TAG  
An hexadecimal identifier available from Cloudflare.
- \<ENV-ID\>  
Your Dynatrace tenant id
- \<TOKEN\>  
An API token with the API v2 scope “Ingest logs”
- \<EMAIL\>  
Your Cloudflare email account
- \<API\_KEY\>  
An API KEY from Cloudflare.
- \<BASIC AUTHORIZATION\>  
An Authorization key from Cloudflare

To enable the Job that initiates the Logpush from the Cloudflare side, you should then execute:

```markup
$ curl -s https://api.cloudflare.com/client/v4/zones/$ZONE_TAG/logpush/jobs -X POST -d '
{
  "name": "dynatrace",
  "logpull_options": "fields=ClientIP,EdgeStartTimestamp,ClientRequestHost,ClientRequestMethod,ClientRequestPath&timestamps=rfc3339",
  "destination_conf": "https://<ENV-ID>.live.dynatrace.com/api/v2/logs/ingest?header_Authorization=Api-Token%20<TOKEN>&header_accept=application/json&header_content-type=application/json",
  "dataset": "http_requests",
  "enabled": true,
  "output_options": { "output_type": "ndjson", "batch_prefix": "[", "batch_suffix": "]", "record_delimiter": ","}
}' \
-H "X-Auth-Email: <EMAIL>" \
-H "X-Auth-Key: <API_KEY>" \
-H "Authorization: Bearer <BASIC AUTHORIZATION>"

```

The main trick, not explained in the Cloudflare documentation, is that Cloudflare, by default, seems to send the ndjson as text/plain. On the Dynatrace side, this is interpreted as a single log line, instead of being considered as JSON data. That’s why in the above example, there is an additional header field passed as “header\_content-type=application/json”, so that Cloudflare sends an appropriate Content-type header to Dynatrace.

After the configuration above, you should start seeing your Cloudflare logs flowing into Dynatrace :dynaspin:

Other information can be configured to be pushed to Dynatrace.&nbsp; For more information on the Cloudflare side, check the [Cloudflare Docs](https://developers.cloudflare.com/logs/about/).
