概要

Cloudflare と統合することで、Web トラフィック、DNS クエリ、脅威に関するインサイトなど、ゾーンのメトリクスを取得できます。インテグレーションは、Cloudflare の分析 API を通じて行われます。

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

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

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

インテグレーションは Datadog Cloud SIEM と連携し、以下に対するすぐに使える脅威検出機能を提供します

  • 不可能移動
  • 危険な誤構成
  • DDoS 攻撃

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

計画と使用

始める前に、Datadog アカウントAPI キー、そして Enterprise アカウントプランが必要な Cloudflare Logpush へのアクセスが必要です。

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

インフラストラクチャーリスト

Datadog の Cloudflare インテグレーションタイルを使用して、インテグレーションをインストールします。

ブラウザトラブルシューティング

  1. Datadog Cloudflare インテグレーションタイル内の Configuration タブに移動します。
  2. 監視するアカウントの電子メールアドレスと、API キーまたはトークンを入力します。Cloudflare API キーと API トークンは、Cloudflare アカウントの My profile > Api Tokens の下にあります。
  3. アカウントの名前を追加します。この名前は任意で、メトリクスの account タグ内で使用されます。

収集データ

Cloudflareでは、Cloudflare Logpush を使用してログを直接 Datadog にプッシュすることができます。Logpush のジョブは Cloudflare API または Cloudflare ダッシュボードで管理できます。

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

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

Cloudflare API

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

    • name (任意): ドメイン名をジョブ名として使用。
    • destination_conf: 以下のパラメーターからなるログの出力先。
      • <DATADOG_ENDPOINT_URL>: Datadog HTTP ログのインテークエンドポイント。エンドポイントは、http-intake.logs./v1/input になります
      • <DATADOG_API_KEY>: 使用する Datadog API キー。
      • ddsource: cloudflare に設定。
      • service (任意): サービス名を指定。
      • host (任意): ホスト名を指定。
      • ddtags (任意): タグを指定。
    • dataset: 受信するログのカテゴリー。サポートされるデータセットについては、Cloudflare のログフィールドを参照。
    • logpull_options (オプション): フィールド、サンプルレート、タイムスタンプ形式の構成は、Logpush API オプションを参照してください。Datadog は、Cloudflare のタイムスタンプ RFC 3339 フォーマットの使用を義務付けており、これは 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. Cloudflare ダッシュボードの Logpush セクションでサービスを接続したら、データセットとデータフィールドを選択し、宛先として 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.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

ヘルプ

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

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

ヘルプ

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

ヘルプ

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

ヘルプ

ご不明な点は、Datadog のサポートチームまでお問合せください。