コンテンツにスキップ

Logstash

Logstash はElasticが開発したオープンソースのデータ処理およびログ管理ツールです。Wallarmを設定して、検出されたイベントの通知をLogstashに送信できます。

通知フォーマット

WallarmはJSON形式のwebhooksを介してLogstashに通知を送信します。JSONオブジェクトのセットは、Wallarmが通知するイベントによって異なります。

新たに検出されたヒットの通知例:

[
    {
        "summary": "[Wallarm] New hit detected",
        "details": {
        "client_name": "TestCompany",
        "cloud": "EU",
        "notification_type": "new_hits",
        "hit": {
            "domain": "www.example.com",
            "heur_distance": 0.01111,
            "method": "POST",
            "parameter": "SOME_value",
            "path": "/news/some_path",
            "payloads": [
                "say ni"
            ],
            "point": [
                "post"
            ],
            "probability": 0.01,
            "remote_country": "PL",
            "remote_port": 0,
            "remote_addr4": "8.8.8.8",
            "remote_addr6": "",
            "tor": "none",
            "request_time": 1603834606,
            "create_time": 1603834608,
            "response_len": 14,
            "response_status": 200,
            "response_time": 5,
            "stamps": [
                1111
            ],
            "regex": [],
            "stamps_hash": -22222,
            "regex_hash": -33333,
            "type": "sqli",
            "block_status": "monitored",
            "id": [
                "hits_production_999_202010_v_1",
                "c2dd33831a13be0d_AC9"
            ],
            "object_type": "hit",
            "anomaly": 0
            }
        }
    }
]

要件

Logstashの設定は以下の要件を満たす必要があります:

  • POSTおよびPUTリクエストを受け付けます

  • HTTPSリクエストを受け付けます

  • パブリックURLを持ちます

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 {
  stdout {} # コマンドライン上にLogstashログを出力するoutputプラグイン
  ...
}

詳細は公式Logstashドキュメントをご覧ください。

統合の設定

  1. Wallarm Console → Integrations → LogstashでLogstash統合の設定に進みます。

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

  3. 対象の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. 通知をトリガーするイベントタイプを選択します。

    Logstash統合

    利用可能なイベントの詳細:

  6. Test integrationをクリックして、設定の正確性、Wallarm Cloudの到達性、および通知フォーマットをご確認ください。

    テスト用のLogstashログ:

    [
        {
            summary:"[Test message] [Test partner(US)] New vulnerability detected",
            description:"Notification type: vuln
    
                        New vulnerability was detected in your system.
    
                        ID: 
                        Title: Test
                        Domain: example.com
                        Path: 
                        Method: 
                        Discovered by: 
                        Parameter: 
                        Type: Info
                        Threat: Medium
    
                        More details: https://us1.my.wallarm.com/object/555
    
    
                        Client: TestCompany
                        Cloud: 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:"Test",
                    discovered_by:null,
                    threat:"Medium",
                    type:"Info"
                }
            }
        }
    ]
    
  7. Add integrationをクリックします。

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

追加アラートの設定

Besides the notifications you have already set up through the integration card, Wallarm triggers allow you to select additional events for notifications:

For condition detailing, you can add one or more filters. As soon, as condition and filters are set, select the integration through which the selected alert should be sent. You can select several integrations simultaneously.

Choosing an integration

中間データ収集ツールとしてのLogstashの利用

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イベントをログに記録するには:

  1. データ収集ツールを構成して、受信したwebhooksを読み取り、ログを次のシステムに転送します。Wallarmはwebhooksを介してイベントをデータ収集ツールに送信します。

  2. SIEMシステムを構成して、データ収集ツールからログを取得し読み取ります。

  3. Wallarmを構成して、データ収集ツールにログを送信します。

Wallarmはwebhooksを介して任意のデータ収集ツールにログを送信できます。

WallarmをFluentdまたはLogstashと統合するには、Wallarm Console UIの該当する統合カードを使用できます。

Wallarmをその他のデータ収集ツールと統合するには、Wallarm Console UIのwebhook統合カードを使用できます。

ログをSIEMシステムに転送する人気のデータ収集ツールとの統合の設定例をいくつか説明します:

WallarmはDatadog API経由のDatadogとのネイティブ統合もサポートします。ネイティブ統合では中間データ収集ツールは不要です。

統合の無効化および削除

You can delete or temporarily disable the integration. While deleting stops sending notificatioins and completely deletes all configuration, disabling just stops sending notifications which you can at any moment re-enable with the same settings.

If for the integration the System related events are selected to trigger notifications, Wallarm will notify about both of these actions.