Get Logs from API

Hi, i am having problems with getting logs from the API i can see other information like dns records etc. the command used is
curl -X GET “https://api.cloudflare.com/client/v4/zones/ZONE_ID/logs/control/retention/flag” -H “Authorization: Bearer TOKEN” -H “Content-Type:application/json” -H “X-Auth-Email:EMAL”
the output is
{
“result”: null,
“success”: false,
“errors”: [
{
“code”: 1010,
“message”: “auth.forbidden”
}
],
“messages”:
}

You should not send x-auth-email if you’re using an API token. Try without that.

Hi, changing the command to be
curl -X GET “https://api.cloudflare.com/client/v4/zones/ZONE_ID/logs/control/retention/flag” -H “Authorization: Bearer TOKEN” -H “Content-Type:application/json”
still gives the same output

The only thing I can think of is to add a space after the colon : in the content-type header, the api token not having the correct permission (permission needed: #logs:edit), or your account not being enterprise and having logpush enabled. Try looking into the first 2 potential issues.

Synchronization error 2 computer API mismatch 2 Login with different time?

I have added the space. no change
we are professional. do we need to upgrade to enterprise?

Yes. Logpush logs (produced by Cloudflare) are only available for the Enterprise plan, which is really just a custom plan with custom pricing.

https://api.cloudflare.com/#logs-received-get-log-retention-flag

Currently, Logpush is available to customers on the Cloudflare Enteprise plan

cc @jpl there’s a typo (Enteprise instead of Enterprise) on the above page.

1 Like