// 模拟测试pipeline POST _ingest/pipeline/_simulate { "pipeline": { "description" : "vpn_log_pipeline", "processors" : [ { "grok" : { "field" : "message", "patterns" : [ """%{TIMESTAMP_ISO8601:error_time} \[HUB "%{NOTSPACE:hub}"\] Session "%{NOTSPACE:session}": A large volume of broadcast packets has been detected. There are cases where packets are discarded based on the policy. The source MAC address is %{NOTSPACE:mac_address}, the source IP address is %{IPV4:source_ip}, the destination IP address is %{IPV4:destination_ip}. The number of broadcast packets is equal to or larger than %{NUMBER:items_per_second} items per 1 second """ ], "ignore_failure" : true }, "convert" : { "field" : "items_per_second", "type" : "integer", "ignore_failure" : true } }, { "date" : { "field" : "error_time", "target_field" : "@timestamp", "formats" : [ "yyyy-MM-dd HH:mm:ss.SSS" ], "timezone" : "Asia/Shanghai" } } ] }, "docs": [ { "_source": { "message": """2022-01-17 14:19:07.047 [HUB "hub_dkwbj"] Session "SID-BRIDGE-20": A large volume of broadcast packets has been detected. There are cases where packets are discarded based on the policy. The source MAC address is 70-B5-E8-2F-C9-5C, the source IP address is 192.168.9.134, the destination IP address is 0.0.0.0. The number of broadcast packets is equal to or larger than 34 items per 1 second (note this information is the result of mechanical analysis of part of the packets and could be incorrect).""" } } ] }
// 增加pipeline PUT _ingest/pipeline/vpn_log_pipeline { "description": "vpn_log_pipeline", "processors": [ { "grok": { "field": "message", "patterns": [ "%{TIMESTAMP_ISO8601:error_time} \\[HUB \"%{NOTSPACE:hub}\"\\] Session \"%{NOTSPACE:session}\": A large volume of broadcast packets has been detected. There are cases where packets are discarded based on the policy. The source MAC address is %{NOTSPACE:mac_address}, the source IP address is %{IP:source_ip}, the destination IP address is %{IP:destination_ip}. The number of broadcast packets is equal to or larger than %{NUMBER:items_per_second} items per 1 second " ], "ignore_failure": true }, "convert": { "field": "items_per_second", "type": "integer", "ignore_failure": true } }, { "date": { "field": "error_time", "target_field": "@timestamp", "formats": [ "yyyy-MM-dd HH:mm:ss.SSS" ], "timezone": "Asia/Shanghai" } } ] }
// 其他操作 GET _ingest/pipeline/vpn_log_pipeline DELETE _ingest/pipeline/vpn_log_pipeline
1 2 3 4 5 6 7 8 9 10 11
//模拟测试添加的pipeline GET _ingest/pipeline/vpn_log_pipeline/_simulate { "docs": [ { "_source": { "message": """2022-01-17 14:19:07.047 [HUB "hub_dkwbj"] Session "SID-BRIDGE-20": A large volume of broadcast packets has been detected. There are cases where packets are discarded based on the policy. The source MAC address is 70-B5-E8-2F-C9-5C, the source IP address is 192.168.9.134, the destination IP address is 0.0.0.0. The number of broadcast packets is equal to or larger than 34 items per 1 second (note this information is the result of mechanical analysis of part of the packets and could be incorrect).""" } } ] }