コンテンツにスキップ

Logstash経由でのSplunk Enterprise連携

本手順では、WallarmとデータコレクターLogstashを連携し、イベントをSplunkのSIEMシステムへ転送するための統合例を示します。

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

Webhookフロー

使用リソース

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
35.235.100.79
34.102.45.38
34.94.241.21
34.102.90.100
34.94.203.193
34.94.238.221
34.94.9.23
34.141.230.156
34.91.138.113
34.90.114.134
35.204.127.78
34.90.24.155

Splunk EnterpriseおよびLogstashのサービスへのリンクは例として記載しているため、応答しません。

Splunk Enterpriseの設定

Logstashのログは、名前をWallarm Logstash logsとし、その他はデフォルト設定のままでSplunkのHTTP Event Controllerに送信します。

HTTP Event Collectorの設定

HTTP Event Controllerへのアクセスには、生成したトークン93eaeba4-97a9-46c7-abf3-4e0c545fa5cbを使用します。

SplunkのHTTP Event Controllerのセットアップの詳細は、Splunk公式ドキュメントにあります。

Logstashの設定

Wallarmはwebhook経由で中継データコレクターLogstashにログを送信するため、Logstashの設定は次の要件を満たす必要があります。

  • POSTまたはPUTリクエストを受け付けること

  • HTTPSリクエストを受け付けること

  • 公開URLを持つこと

  • Splunk Enterpriseへログを転送すること(本例ではhttpプラグインを使用して転送)

Logstashはlogstash-sample.confファイルで設定します:

  • 受信webhookの処理はinputセクションで設定します:

    • トラフィックはポート5044に送られます
    • LogstashはHTTPS接続のみを受け付けるように設定します
    • 公的に信頼されたCAが署名したLogstashのTLS証明書は/etc/server.crtに配置します
    • TLS証明書の秘密鍵は/etc/server.keyに配置します
  • Splunkへの転送とログ出力はoutputセクションで設定します:

    • LogstashからSplunkへはJSON形式でログを転送します
    • すべてのイベントログはPOSTリクエストでLogstashからSplunkのAPIエンドポイントhttps://109.111.35.11:8088/services/collector/rawへ転送します。リクエストの認可にはHTTPS Event Collectorのトークンを使用します
    • さらに、(コードの15行目で)Logstashのログをコマンドラインにも出力します。この設定は、イベントがLogstash経由で記録されていることを確認するために使用します
input {
  http { # HTTP/HTTPSトラフィック用のinputプラグイン
    port => 5044 # 受信リクエスト用のポート
    ssl => true # HTTPSトラフィックの処理
    ssl_certificate => "/etc/server.crt" # LogstashのTLS証明書
    ssl_key => "/etc/server.key" # TLS証明書の秘密鍵
  }
}
output {
  http { # HTTP/HTTPSでLogstashからログを転送するためのoutputプラグイン
    format => "json" # 転送するログの形式
    http_method => "post" # ログ転送に使用するHTTPメソッド
    url => "https://109.111.35.11:8088/services/collector/raw" # ログの転送先エンドポイント
    headers => ["Authorization", "Splunk 93eaeba4-97a9-46c7-abf3-4e0c545fa5cb"] # リクエストの認可に使用するHTTPヘッダー
  }
  stdout {} # Logstashのログをコマンドラインに出力するoutputプラグイン
}

設定ファイルの詳細はLogstash公式ドキュメントにあります。

Logstash設定のテスト

Logstashのログが作成されSplunkへ転送されていることを確認するには、LogstashにPOSTリクエストを送信します。

リクエスト例:

curl -X POST 'https://logstash.example.domain.com' -H "Content-Type: application/json" -H "Authorization: Splunk 93eaeba4-97a9-46c7-abf3-4e0c545fa5cb" -d '{"key1":"value1", "key2":"value2"}'

Logstashのログ:
Logstashのログ

Splunkのイベント:
Splunkのイベント

Logstash統合の設定

  • Webhooks are sent to https://logstash.example.domain.com

  • Webhooks are sent via POST requests

  • The webhook integration has default advanced settings

  • Webhooks sent to Webhook URLs are all available events: hits, system events, vulnerabilities, scope changes

LogstashとのWebhook統合

Logstash統合の設定の詳細

テストの例

To test the configuration, a new user is added in Wallarm Console:

Adding user

Logstashはイベントを次のように記録します。

LogstashからSplunkへの新規ユーザーに関するログ

Splunkのイベントには次のエントリが表示されます。

LogstashからSplunkに表示される新規ユーザーカード

ダッシュボードでイベントを整理して表示する

To get Wallarm events organized into a ready-to-use dashboard in Splunk 9.0 or later, you can install the Wallarm application for Splunk.

This application provides you with a pre-configured dashboard that is automatically filled with the events received from Wallarm. In addition to that, the application enables you to proceed to detailed logs on each event and export the data from the dashboard.

Splunk dashboard

To install the Wallarm application for Splunk:

  1. In the Splunk UI ➝ Apps find the Wallarm API Security application.

  2. Click Install and input the Splunkbase credentials.

If some Wallarm events are already logged in Splunk, they will be displayed on the dashboard, as well as further events Wallarm will discover.

In addition, you can fully customize the ready-to-use dashboard, e.g. its view or search strings used to extract data from all Splunk records.