簡體   English   中英

Filebeat未將數據發送到Logstash

[英]Filebeat is not sending data to Logstash

我正在嘗試將警報從Snort IDS發送到Elasticsearch,因此我正在使用3種技術:

  • Elasticsearch- https: //pastebin.com/uCNMaZFJ
  • Logstash- https: //pastebin.com/zgnbbw9K
  • Filebeat- https: //pastebin.com/45rC3rW5

我的filebeat配置文件中包含以下代碼:

input {
beats {
    port => 5044
}

}過濾器{

if [type] == "snort" {

    # parse the message into individual fields
    grok {
        match => { "message" => "(?<ts>.*\d{2}:\d{2}:\d{2})\s(?<host>.*?)\s.*?\s\[(?<generator_id>.*?)::(?<signature_id>.*?):.*?\]\s(?<signature>.*?)\s\[Classification:\s(?<classification>.*?)\]\s\[Priority:\s(?<priority>.*?)\].*?{(?<protocol>.*?)\}\s(?<source_ip>.*?):(?<source_port>.*?)\s-\>\s(?<destination_ip>.*?):(?<destination_port>.*)" }
    }

    # remove the original message if parsing was successful
    if !("_grokparsefailure" in [tags]) {
        mutate {
            remove_field => [ "message" ]
        }
    }

    # parse the timestamp and save in a new datetime field
    if [ts] {
        date {
            match => [ "ts", "MMM dd HH:mm:ss" ]
            target => "sys_timestamp"
        }

        # remove the original timestamp if date parsing was successful
        if !("_dateparsefailure" in [tags]) {
            mutate {
                remove_field => [ "ts" ]
            }
        }
    }
}

}輸出{

# save events to Elasticsearch with the uuid as the document id
elasticsearch {
    hosts => ["localhost:9200"]
manage_template => false
    index => "teste-%{+YYYY-MM-dd}"
}

}

我希望在檢查“ http:// localhost:9200 / ola- * / _ search?pretty”時看到snort的警報日志,但是未檢索到警報。 我正在努力解決此問題...我不知道問題是什么。

提前致謝!

您的堆棧是什么版本? 您的filebeat配置文件同時具有filebeat.prospectorsfilebeat.inputs ,從6.3版filebeat.inputs ,您應該使用filebeat.inputs而不是filebeat.prospectors

同樣從6.0版開始刪除了document_type配置,您的消息可能沒有名為snort type字段,它是logstash管道中的主要過濾器。 最好使用標簽過濾郵件。

而是在您的filebeat.yml使用它。

filebeat.inputs:
- type: log
  paths:
    - /var/log/snort/*.log
  tags: ["snort"]

並更改您的logstash過濾器,只需if "snort" in [tags]使用if "snort" in [tags]而不是if [type] == "snort"

您的輸出會將收到的所有消息發送到名為teste-%{+YYYY-MM-dd}的索引,為什么要對名為ola-*的索引進行搜索? 您應該對teste-*索引進行搜索。

我建議您使用stdout輸出運行管道,以查看發生了什么。

只需將其放在您的管道中,以查看是否收到任何消息以及這些消息如何。

output {
  stdout { }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM