コンテンツにスキップ

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フロー

使用リソース

  • Splunk Enterprise(WEB URL https://109.111.35.11:8000およびAPI URL https://109.111.35.11:8088

  • Logstash 7.7.0はDebian 11.x (bullseye)にインストールされており、https://logstash.example.domain.comで利用可能です。

  • EU cloudにあるWallarm Consoleへの管理者アクセスが必要で、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

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形式で転送されます
    • LogstashからSplunkのAPIエンドポイントhttps://109.111.35.11:8088/services/collector/rawへはPOSTリクエストを介してすべてのイベントログが転送されます。リクエストの認証にはHTTPS Event Collectorトークンが使用されます
    • Logstashログはコマンドライン(15行目)にも出力されます。この設定は、Logstashを介してイベントがログ出力されることを検証するために使用されます
input {
  http { # HTTPおよびHTTPSトラフィック用の入力プラグイン
    port => 5044 # 受信リクエスト用のポート
    ssl => true # HTTPSトラフィック処理
    ssl_certificate => "/etc/server.crt" # Logstash TLS証明書
    ssl_key => "/etc/server.key" # TLS証明書用秘密鍵
  }
}
output {
  http { # HTTP/HTTPSプロトコルを介してLogstashからログを転送する出力プラグイン
    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ログを出力する出力プラグイン
}

設定ファイルの詳細な説明は公式Logstashドキュメントで確認できます。

Logstash 設定のテスト

Logstashログが生成されSplunkへ転送されるか確認するために、POSTリクエストをLogstashへ送信できます。

リクエスト例:

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.