概要

Integrate with Cloudflare to get your zone metrics, including web traffic, DNS queries, and threat insights. The integration is based on Cloudflare’s analytics API. Learn more about what resources correspond with which metrics in our documentation.

Log Collection: In addition to these metrics, Cloudflare allows customers to push logs directly into Datadog using Cloudflare Logpush. These detailed logs contain metadata generated by Cloudflare products and are helpful for debugging and creating analytics, especially when combined with logs from other sources. Enable Cloudflare log collection in combination with these metrics to get full visibility into your Cloudflare environment.

すぐに使えるダッシュボードは、アプリケーションのセキュリティとパフォーマンスを向上させます。この一元化されたダッシュボードにより、以下の要素が視覚化されます

  • セキュリティ脅威
  • HTTP リクエスト量とエラー率
  • 往復時間とトラフィックフローの変更を含むロードバランシング
  • ワーカースクリプトにおけるパフォーマンスの問題

Cloudflare インフラストラクチャーを深く洞察するリッチ化されたログと詳細なメトリクスにより、問題解決に必要なコンテキストを構築できます。

The integration works with Datadog Cloud SIEM to provide out-of-the-box threat detection for

  • 不可能移動
  • dangerous misconfigurations
  • DDoS 攻撃

IP アドレスのブロックや Datadog でのケースの作成など、同梱されている Workflow Automation のブループリントを利用して、セキュリティ脅威をより迅速に緩和できます。

セットアップ

Before you begin, you need a Datadog account, with an API key, and access to Cloudflare Logpush, which requires an Enterprise account plan.

Cloudflare API トークンを使用する場合は、Zone > Zone > Read および Zone > Analytics > Read の権限を保有していることを確認してください。

インストール

Install the integration with the Datadog Cloudflare integration tile.

構成

  1. Go to the Configure tab inside the Datadog Cloudflare integration tile.
  2. 監視するアカウントの電子メールアドレスと、API キーまたはトークンを入力します。Cloudflare API キーと API トークンは、Cloudflare アカウントの My profile > Api Tokens の下にあります。
  3. アカウントの名前を追加します。この名前は任意で、メトリクスの account タグ内で使用されます。

ログ収集

Cloudflare allows customers to push logs directly into Datadog using Cloudflare Logpush. You can manage the Logpush job with the Cloudflare API or directly within your Cloudflare dashboard.

Cloudflare インテグレーションパイプラインをインストールすると、特定の属性が自動的にリマップされます。どの属性がリマップされるかを確認するには

  1. Navigate to Logs Pipelines.
  2. 右上の Browse Pipeline Library をクリックします。
  3. 検索バーに Cloudflare と入力します。
  4. Cloudflare をクリックすると、インストールされているリマッパーなどのプロセッサーのリストが表示されます。

Cloudflare API

  1. Logpush ジョブエンドポイントへ POST をリクエストし、Logpush ジョブを作成します。以下のフィールドを含めます。

    • name (任意): ドメイン名をジョブ名として使用。
    • destination_conf: 以下のパラメーターからなるログの出力先。
      • <DATADOG_ENDPOINT_URL>: The Datadog HTTP logs intake endpoint, which can be either one below. You can find the difference at Datadog API reference.
        • v1: http-intake.logs./v1/input
        • v2 (latest): http-intake.logs./api/v2/logs
      • <DATADOG_API_KEY>: 使用する Datadog API キー。
      • ddsource: cloudflare に設定。
      • service (任意): サービス名を指定。
      • host (任意): ホスト名を指定。
      • ddtags (任意): タグを指定。
    • dataset: The category of logs you want to receive. See the Cloudflare Log fields for a list of supported datasets.
    • logpull_options (optional): To configure fields, sample rate, and timestamp format, see the Logpush API options. Datadog mandates the use of RFC 3339 format for timestamps from Cloudflare, which is the default option used by Cloudflare.

    リクエスト例:

    curl -s -X POST 'https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/logpush/jobs' \
    --header 'X-Auth-Key: <CLOUDFLARE_AUTH_KEY>' \
    --header 'X-Auth-Email: <CLOUDFLARE_AUTH_EMAIL>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
       "name": "<NAME>",
       "destination_conf": "datadog://<DATADOG_ENDPOINT_URL>?header_DD-API-KEY=<DATADOG_API_KEY>&ddsource=cloudflare&service=cloudflare&ddtags=env:dev",
       "logpull_options": "fields=RayID,EdgeStartTimestamp&timestamps=rfc3339",
       "dataset": "http_requests"
    }'
    

    応答例:

    {
     "errors": [],
     "messages": [],
     "result": {
       "id": 100,
       "dataset": "http_requests",
       "enabled": false,
       "name": "<DOMAIN_NAME>",
       "logpull_options": "fields=RayID,EdgeStartTimestamp&timestamps=rfc3339",
       "destination_conf": "datadog://http-intake.logs./v1/input?header_DD-API-KEY=<DD-API-KEY>&ddsource=cloudflare&service=cloudflare&ddtags=env:dev",
       "last_complete": null,
       "last_error": null,
       "error_message": null
     },
     "success": true
    }
    

    id の値をメモしておきます。上記の例では、100 です。

  2. ジョブを有効にします。応答で返されたジョブ ID を使用してリクエスト本文で {"enabled": true} を送信します。

    リクエスト例:

    curl -s -X PUT \
    https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/logpush/jobs/<JOB_ID> -d'{"enabled":true}' | jq .
    

    応答例:

    {
      "errors": [],
      "messages": [],
      "result": {
        "id": 100,
        "dataset": "http_requests",
        "enabled": true,
        "name": "<DOMAIN_NAME>",
        "logpull_options": "fields=RayID,EdgeStartTimestamp&timestamps=rfc3339",
        "destination_conf": "datadog://?header_DD-API-KEY=<DATADOG-API-KEY>",
        "last_complete": null,
        "last_error": null,
        "error_message": null
      },
      "success": true
    }
    

Cloudflare ダッシュボード

  1. Once you have connected a service with the Logpush section of the Cloudflare dashboard, select the dataset, select data fields, and then, under select destination, choose Datadog.

  2. Enter destination information の下で Datadog の URL エンドポイントを入力します。

    http-intake.logs./api/v2/logs?ddsource=cloudflare
    

    : ddsource=cloudflare は必須です。ログを区別するために、オプションで servicehostddtags などのパラメーターを追加することもできます。

    :

    http-intake.logs./api/v2/logs?service=<SERVICE>&host=<HOST>&ddsource=cloudflare
    
  3. Datadog Cloudflare インテグレーションタイルのセットアップに使用した Datadog API キーを入力します。

  4. アクセスを確認すると、Prove ownership の下に “Ready to push!” と表示されます。Push をクリックして完了します。

収集データ

メトリクス

cloudflare.requests.all
(count)
Total request count
Shown as request
cloudflare.requests.cached
(count)
Cached requests count
Shown as request
cloudflare.requests.uncached
(count)
Uncached requests count
Shown as request
cloudflare.requests.ssl.encrypted
(count)
SSL encrypted requests count
Shown as request
cloudflare.requests.ssl.unencrypted
(count)
Unencrypted requests count
Shown as request
cloudflare.requests.country
(count)
Request count, tagged by IATA country code
Shown as request
cloudflare.requests.status
(count)
Request count, tagged by HTTP response code
Shown as request
cloudflare.requests.content_type
(count)
Request count, tagged by Content-Type
Shown as request
cloudflare.requests.ip_class
(count)
Request count, tagged by IP class
Shown as request
cloudflare.requests.cross_zone_sub_requests.avg
(gauge)
The proportion of requests that were inititiated by a Cloudflare Worker on another zone
Shown as request
cloudflare.requests.edge_dns_response_time.avg
(gauge)
Average edge dns response time in milliseconds
Shown as millisecond
cloudflare.requests.edge_time_to_first_byte.avg
(gauge)
Average time to first byte in milliseconds
Shown as millisecond
cloudflare.requests.origin_response_duration.avg
(gauge)
The average originResponseDuration in milliseconds excluding 0 values (i.e. cached ones)
Shown as millisecond
cloudflare.bandwidth.all
(count)
Total bandwidth
Shown as byte
cloudflare.bandwidth.cached
(count)
Cached bandwidth
Shown as byte
cloudflare.bandwidth.uncached
(count)
Uncached bandwidth
Shown as byte
cloudflare.bandwidth.ssl.encrypted
(count)
SSL encrypted bandwidth
Shown as byte
cloudflare.bandwidth.ssl.unencrypted
(count)
Unencrypted bandwidth
Shown as byte
cloudflare.bandwidth.country
(count)
Bandwidth tagged by IATA country code
Shown as byte
cloudflare.bandwidth.content_type
(count)
Bandwidth tagged by Content-Type
Shown as byte
cloudflare.threats.all
(count)
Total threats
Shown as operation
cloudflare.threats.type
(count)
Threats tagged by type
Shown as operation
cloudflare.threats.country
(count)
Threats tagged by IATA country code
Shown as operation
cloudflare.pageviews.all
(count)
Total page views
Shown as page
cloudflare.pageviews.search_engine
(count)
Page views tagged by search engine
Shown as page
cloudflare.uniques.all
(count)
Unique visitors count
Shown as connection
cloudflare.dns.query.all
(count)
DNS query count
Shown as request
cloudflare.dns.query.uncached
(count)
Uncached DNS query count
Shown as request
cloudflare.dns.query.stale
(count)
Stale DNS query count
Shown as request
cloudflare.dns.response_time.avg
(gauge)
DNS query average response time
Shown as millisecond
cloudflare.dns.response_time.median
(gauge)
DNS query median response time
Shown as millisecond
cloudflare.dns.response_time.90p
(gauge)
DNS query response time to the 90th percentile
Shown as millisecond
cloudflare.dns.response_time.99p
(gauge)
DNS query response time to the 99th percentile
Shown as millisecond
cloudflare.workers.requests.all
(count)
The request count to the worker script (metrics may not show without enabled API Key permissions)
Shown as request
cloudflare.workers.requests.errors
(count)
The error count to the worker script (metrics may not show without enabled API Key permissions)
Shown as request
cloudflare.workers.requests.subrequests
(count)
The subrequest count to the worker script (metrics may not show without enabled API Key permissions)
Shown as request
cloudflare.workers.response_time.75p
(gauge)
The worker response time to the 75th percentile (metrics may not show without enabled API Key permissions)
Shown as microsecond
cloudflare.workers.response_time.99p
(gauge)
The worker response time to the 99th percentile (metrics may not show without enabled API Key permissions)
Shown as microsecond
cloudflare.load_balancer.pool.round_trip_time.average
(gauge)
The average round trip time to reach the load balancer pool
Shown as millisecond
cloudflare.load_balancer.pool.health.status
(count)
The load balancer pool health status
Shown as request

Metric categories

以下の表では、収集されるメトリクスの種類と関連するメトリクスのプレフィックスについて説明します。

説明Metric Prefixes Collected
Web AnalyticsMetrics related to web traffic and performance.cloudflare.requests.all
cloudflare.requests.cached
cloudflare.requests.uncached
cloudflare.requests.ssl.encrypted
cloudflare.requests.ssl.unencrypted
cloudflare.requests.country
cloudflare.requests.status
cloudflare.requests.content_type
cloudflare.requests.ip_class
cloudflare.bandwidth.all
cloudflare.bandwidth.cached
cloudflare.bandwidth.uncached
cloudflare.bandwidth.ssl.encrypted
cloudflare.bandwidth.ssl.unencrypted
cloudflare.bandwidth.country
cloudflare.bandwidth.content_type
cloudflare.threats.all
cloudflare.threats.type
cloudflare.threats.country
cloudflare.pageviews.all
cloudflare.pageviews.search_engine
cloudflare.uniques.all
DNSMetrics related to DNS queries and response times.cloudflare.dns.query.all
cloudflare.dns.query.uncached
cloudflare.dns.query.stale
cloudflare.dns.response_time.avg
cloudflare.dns.response_time.median
cloudflare.dns.response_time.90p
cloudflare.dns.response_time.99p
Load BalancerMetrics related to load balancing pools.cloudflare.load_balancer.pool.round_trip_time.average
cloudflare.load_balancer.pool.health.status
Worker ScriptMetrics related to Cloudflare Workers scripts.cloudflare.workers.requests.all
cloudflare.workers.requests.errors
cloudflare.workers.requests.subrequests
cloudflare.workers.response_time.75p
cloudflare.workers.response_time.99p

権限

Cloudflare API トークンでこれらのアクセス許可が有効になっていることを確認します。

スコープアクセス許可ステータス
アカウントアカウント分析読み取り
アカウントアカウント設定読み取り
アカウントワーカースクリプト読み取り
ZoneZone読み取り
Zone分析読み取り
Zoneワーカールート読み取り
Zoneロードバランサー読み取り

イベント

Cloudflare インテグレーションには、イベントは含まれません。

サービスチェック

Cloudflare インテグレーションには、サービスのチェック機能は含まれません。

トラブルシューティング

Need help? Contact Datadog support.

PREVIEWING: alai97/reorganize-some-sections-in-dora-metrics