コンテンツにスキップ

Datadog経由のFluentd/Logstash

WallarmはFluentdまたはLogstash中継データ収集システムを介して、検出イベントの通知をDatadogに送信するように設定できます。

The most common logging scheme in complex systems consists of the following components:

  • Data collector: accepts logs from several sources and forwards logs to the SIEM system

  • SIEM system or log management systems: used to analyze logs and monitor the system status

Wallarmからデータ収集システム経由でDatadogへ通知を送信

Datadogとのネイティブ統合

WallarmはDatadog APIを利用したDatadogとのネイティブ統合もサポートします。ネイティブ統合では、中継データ収集システムの使用は不要です。

使用リソース

  • パブリックURLで利用可能なFluentdまたはLogstashサービス

  • パブリックURLで利用可能なDatadogサービス

  • Wallarm Console(EUクラウド)への管理者アクセスで、Fluentd/Logstash統合の設定が可能

Wallarm Cloud IP addresses

To provide Wallarm Cloud access to your system, you may need a list of its public IP addresses:

35.235.66.155
34.102.90.100
34.94.156.115
35.235.115.105
34.94.85.217
34.94.51.234
34.102.59.122
34.94.238.72
34.141.230.156
34.91.138.113
34.90.114.134
35.204.127.78

要件

Wallarmはwebhookを介して中継データ収集システムへログを送信するため、FluentdまたはLogstashの構成は以下の要件を満たす必要があります:

  • POSTまたはPUTリクエストを受け入れる

  • HTTPSリクエストを受信する

  • パブリックURLを持つ

  • datadog_logs Logstashプラグインまたはfluent-plugin-datadog Fluentdプラグインを介してログをDatadogに転送する

  1. Datadogにログを転送するためにInstall the datadog_logs pluginを実施します。
  2. Logstashを設定して、受信リクエストを読み取り、ログをDatadogに転送するように構成します。

例: logstash-sample.conf構成ファイルの設定例:

input {
  http { # HTTPおよびHTTPSトラフィックの入力プラグイン
    port => 5044 # 受信リクエスト用のポート
    ssl => true # HTTPSトラフィックの処理
    ssl_certificate => "/etc/server.crt" # Logstash用TLS証明書
    ssl_key => "/etc/server.key" # TLS証明書用秘密鍵
  }
}
filter {
  mutate {
    add_field => {
        "ddsource" => "wallarm" # Wallarmログの追加フィルタリングのためにDatadogログレコードにソースフィールドを追加するmutateフィルタ
    }
  }
}
output {
  stdout {} # Logstashログをコマンドラインに出力する出力プラグイン
  datadog_logs { # LogstashログをDatadogに転送する出力プラグイン
      api_key => "XXXX" # Datadogで組織向けに生成されたAPIキー
      host => "http-intake.logs.datadoghq.eu" # Datadogのエンドポイント(登録地域に依存)
  }
}
  1. Datadogにログを転送するためにInstall the fluent-plugin-datadog pluginを実施します。
  2. Fluentdを設定して、受信リクエストを読み取り、ログをDatadogに転送するように構成します。

例: td-agent.conf構成ファイルの設定例:

<source>
  @type http # HTTPおよびHTTPSトラフィックの入力プラグイン
  port 9880 # 受信リクエスト用のポート
  <transport tls> # 接続処理の設定
    cert_path /etc/ssl/certs/fluentd.crt
    private_key_path /etc/ssl/private/fluentd.key
  </transport>
</source>
<match datadog.**>
  @type datadog # FluentdからDatadogにログを転送する出力プラグイン
  @id awesome_agent
  api_key XXXX # Datadogで組織向けに生成されたAPIキー
  host 'http-intake.logs.datadoghq.eu' # Datadogのエンドポイント(登録地域に依存)

  # オプション
  include_tag_key true
  tag_key 'tag'

  # オプションのタグ
  dd_source 'wallarm' # Wallarmログの追加フィルタリングのためにDatadogログレコードにソースフィールドを追加
  dd_tags 'integration:fluentd'

  <buffer>
          @type memory
          flush_thread_count 4
          flush_interval 3s
          chunk_limit_size 5m
          chunk_limit_records 500
  </buffer>
</match>

FluentdまたはLogstashとの統合の設定

  1. Wallarm ConsoleのIntegrationsFluentd/Logstashに進み、Datadog統合設定に移ります。

  2. 統合名を入力します。

  3. 対象のFluentdまたはLogstashのURL(Webhook URL)を指定します。

  4. 必要に応じて、詳細設定を構成します:

    • Request method: POST or PUT. By default, POST requests are sent.
    • Request header and its value if the server requires a non-standard header to execute the request. The number of headers is not limited.
    • CA certificate: certificate of CA that signed a server certificate. If CA is publicly trusted, this field is optional. If a server certificate is self-signed, this field is required and must contain a certificate of your own CA that signed a server certificate.
    • Verify TLS certificate: this setting allows to disable verification of the specified server certificate. By default, Wallarm verifies whether a server certificate is signed by a publicly trusted CA. We do not recommend disabling the verification of production server certificates. If your server uses a self-signed TLS certificate, you can add a self-signed CA certificate to allow sending requests to this server.
    • Request timeout, in seconds: if the server does not respond to the request within the specified time, the request fails. By default: 15 seconds.
    • Connection timeout, in seconds: if the connection to the server cannot be established during the specified time, the request fails. By default: 20 seconds.
    • Wallarm data format: either a JSON Array (default) or a New Line Delimited JSON (NDJSON).
  5. 指定されたURLへ通知送信をトリガーするイベントタイプを選択します。イベントが選択されていない場合、通知は送信されません。

  6. 統合のテストを行い、設定が正しいことを確認します。

  7. Add integrationをクリックします。

Fluentd統合の例:

Fluentdとの統合を追加

統合のテスト

Integration testing allows checking configuration correctness, availability of the Wallarm Cloud, and the notification format. To test the integration, you can use the button Test integration when creating or editing the integration.

The integration is tested as follows:

  • Test notifications with the prefix [Test message] are sent to the selected system.

  • Test notifications cover the following events (each in a single record):

    • New user in the company account
    • Newly detected hit
    • Newly discovered IP in the company scope
    • New trigger in the company account
    • Newly discovered security vulnerability
  • Test notifications include test data.

FluentdまたはLogstash中継データ収集システム内のテストログ:

[
    {
        summary:"[テストメッセージ] [テストパートナー(US)] 新たな脆弱性を検出しました",
        description:"通知タイプ: vuln

                    システムで新たな脆弱性が検出されました。

                    ID: 
                    タイトル: テスト
                    ドメイン: example.com
                    パス: 
                    メソッド: 
                    検出者: 
                    パラメータ: 
                    タイプ: Info
                    脅威: Medium

                    詳細: https://us1.my.wallarm.com/object/555


                    クライアント: TestCompany
                    クラウド: US
                    ",
        details:{
            client_name:"TestCompany",
            cloud:"US",
            notification_type:"vuln",
            vuln_link:"https://us1.my.wallarm.com/object/555",
            vuln:{
                domain:"example.com",
                id:null,
                method:null,
                parameter:null,
                path:null,
                title:"テスト",
                discovered_by:null,
                threat:"Medium",
                type:"Info"
            }
        }
    }
]

テストDatadogログ

他のレコードの中からWallarmログを見つけるには、Datadog Logsサービス内でsource:wallarm_cloud検索タグを使用します。