0

私は新しい Logstash ユーザーで、いくつかの grok ルールを書き始めて、自分の asa ログ ファイルを解析しています。適切にトリガーされるいくつかのルールがあり、grok デバッガーでテストしても、イベントを適切に解析することができず、常に適切にテストされます。このイベントには常に_grokparsefailureフラグがあります。

ここにイベントがあります:

<166>: 2 月 26 日 23:44:14 PST: %ASA-session-6-305012: 内部からのティアダウン動的 TCP 変換:192.168.1.45/53838 から外部:71.110.113.180/53838 期間 0:00:30

そして私のグロクパターン:

<%{POSINT:syslog_pri}>:%{CISCOTIMESTAMP:timestamp} PST: %ASA-session-6-305012: Teardown dynamic TCP translation from %{WORD:source_interface_name}:%{IP:source_ip}/%{POSINT:source_port} to %{WORD:destination_interface_name}:%{IP:destination_ip}/%{POSINT:destination_port} duration (?<translation_duration>\d+:\d+:\d+)

私のフィルターセットは以下の通りです:

filter {
        grok {
                match   => ["message", "<%{POSINT:syslog_pri}>:%    {CISCOTIMESTAMP:timestamp} PST: %ASA-session-6-305011: Built dynamic TCP translation from %{WORD:source_interface_name}:%{IP:source_ip}/%{POSINT:source_port} to %{WORD:destination_interface_name}:%{IP:destination_ip}/%{POSINT:destination_port}" ]

            match   => ["messgae", "<%{POSINT:syslog_pri}>:%{CISCOTIMESTAMP:timestamp} PST: %ASA-session-6-305012: Teardown dynamic TCP translation from %{WORD:source_interface_name}:%{IP:source_ip}/%{POSINT:source_port} to %{WORD:destination_interface_name}:%{IP:destination_ip}/%{POSINT:destination_port} duration (?<translation_duration>\d+:\d+:\d+)" ]

            match   => ["message", "<%{POSINT:syslog_pri}>:%{CISCOTIMESTAMP:timestamp} PST: %ASA-session-6-305011: Built dynamic UDP translation from %{WORD:source_interface_name}:%{IP:source_ip}/%{POSINT:source_port} to %{WORD:destination_interface_name}:%{IP:destination_ip}/%{POSINT:destination_port}" ]

            match   => ["message", "<%{POSINT:syslog_pri}>:%{CISCOTIMESTAMP:timestamp} PST: %ASA-session-6-305012: Teardown dynamic UDP translation from %{WORD:source_interface_name}:%{IP:source_ip}/%{POSINT:source_port} to %{WORD:destination_interface_name}:%{IP:destination_ip}/%{POSINT:destination_port} duration (?<translation_duration>\d+:\d+:\d+)" ]

    }

    geoip {
            source  => "source_ip"
    }

    geoip {
            source  => "destination_ip"
    }

ご指導ありがとうございます。

4

1 に答える 1

0

次のように、最後に名前付きキャプチャの代わりに組み込みの grok フィルターを使用してみてください。

<%{POSINT:syslog_pri}>:%{CISCOTIMESTAMP:timestamp} PST: %ASA-session-6-305012: %{WORD:source_interface_name} からの動的 TCP 変換の破棄:%{IP:source_ip}/%{POSINT:source_port } から %{WORD:destination_interface_name}:%{IP:destination_ip}/%{POSINT:destination_port} 期間 %{NONNEGINT:dur_hour}:%{NONNEGINT:dur_min}:%{NONNEGINT:dur_sec}

入力として使用する単純な test.conf を作成することもできます。

stdin{} 

出力を次のように設定します。

output { stdout { codec => rubydebug } }

logstash -f test.conf < [your test data] を実行すると、何が起こっているかについての追加情報が得られるはずです。

于 2015-02-28T16:29:20.073 に答える