# Cloudflare logpush to http elastic agent

**URL:** https://discuss.elastic.co/t/cloudflare-logpush-to-http-elastic-agent/344383
**Category:** Elastic Agent
**Created:** [October 4, 2023, 12:08pm UTC](https://discuss.elastic.co/t/cloudflare-logpush-to-http-elastic-agent/344383 "2023-10-04T12:08:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gyterpena](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@gyterpena](https://discuss.elastic.co/u/gyterpena)
#### Post date: [October 4, 2023, 12:08pm UTC](https://discuss.elastic.co/t/cloudflare-logpush-to-http-elastic-agent/344383/1 "2023-10-04T12:08:56Z")

</div>

Hello  
I'm trying to set up logpush integration with CF. I have set up elastic agent per documentation

> **[Cloudflare Logpush | Documentation](https://docs.elastic.co/integrations/cloudflare_logpush)**
>
> Collect and parse logs from Cloudflare API with Elastic Agent.

and I'm trying to enable logpush on CF by API

> **[Enable Logpush to Elastic · Cloudflare Logs docs](https://developers.cloudflare.com/logs/get-started/enable-destinations/elastic/)**
>
> Push your Cloudflare logs to Elastic for instant visibility and insights. Enabling this integration with Elastic comes with a predefined dashboard to …

but I'm getting

```auto
{"errors":[{"code":1002,"message":"error validating destination: error writing object: error uploading to https: 415 {\"message\":\"wrong Content-Type header, expecting application/json\"}"}],"messages":[],"result":null,"success":false}

```

I'm seeing part of this error mentioned here

> **[Enable HTTP destination · Cloudflare Logs docs](https://developers.cloudflare.com/logs/get-started/enable-destinations/http/)**
>
> Cloudflare Logpush now supports the ability to send logs to configurable HTTP endpoints.

with explanation

```auto
The ownership_challenge parameter is not required to create a Logpush job to an HTTP endpoint. You need to make sure that the file upload to validate the destination accepts a gzipped test.txt.gz with content as {“content”:“tests”} compressed, otherwise it will return an error, like error validating destination: error writing object: error uploading.

```

But don't know how to make elastic agent to accept test.txt.gz or if this is indeed cause of error I get.

---

<div class="post-metadata">

### Author: ![gyterpena](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@gyterpena](https://discuss.elastic.co/u/gyterpena)
#### Post date: [October 20, 2023, 9:44am UTC](https://discuss.elastic.co/t/cloudflare-logpush-to-http-elastic-agent/344383/2 "2023-10-20T09:44:03Z")

</div>

```auto
This is caused by missing application/json header in destination_conf field of api call. Below call works.
curl --location --request POST 'https://api.cloudflare.com/client/v4/zones/<ZONE ID>/logpush/jobs' \
--header 'X-Auth-Key: <X-AUTH-KEY>' \
--header 'X-Auth-Email: <X-AUTH-EMAIL>' \
--header 'Authorization: <BASIC AUTHORIZATION>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name":"<public domain>",
    "destination_conf": "https://<public domain>:<public port>/<dataset path>?header_Content-Type=application/json&header_<secret_header>=<secret_value>",
    "dataset": "audit",
    "logpull_options": "fields=RayID,EdgeStartTimestamp&timestamps=rfc3339"
}'

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 17, 2023, 9:44am UTC](https://discuss.elastic.co/t/cloudflare-logpush-to-http-elastic-agent/344383/3 "2023-11-17T09:44:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
