【问题标题】:Filebeat is not sending data to LogstashFilebeat 没有向 Logstash 发送数据
【发布时间】:2019-02-04 02:01:13
【问题描述】:

我正在尝试将警报从 Snort IDS 发送到 Elasticsearch,因此我使用了 3 种技术:

我的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 的警报日志,但是没有检索到警报。我正在努力解决这个问题...我不知道是什么问题。

提前致谢!

【问题讨论】:

    标签: elasticsearch logstash filebeat snort


    【解决方案1】:

    您的堆栈版本是什么?您的 filebeat 配置文件同时具有 filebeat.prospectorsfilebeat.inputs,从 6.3 版本开始您应该使用 filebeat.inputs 而不是 filebeat.prospectors

    此外,document_type 配置自 6.0 版以来已被删除,您的消息可能没有名为 type 且值为 snort 的字段,这是您在 logstash 管道中的主要过滤器。最好使用标签过滤您的消息。

    改为在您的filebeat.yml 中使用它。

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

    并更改您的logstash过滤器,只需使用if "snort" in [tags]而不是if [type] == "snort"

    您的输出将您收到的任何消息发送到名为teste-%{+YYYY-MM-dd} 的索引,您为什么要针对名为ola-* 的索引运行搜索?您应该针对 teste-* 索引运行搜索。

    我建议您使用 stdout 输出运行管道以查看发生了什么。

    只需将它放在您的管道上,看看您是否收到任何消息以及这些消息如何。

    output {
      stdout { }
    }
    

    【讨论】:

    • 非常感谢您的宝贵时间和帮助!你有理由......我也觉得我不能直接在Filebeat中使用Unified2文件格式......我必须想办法克服这个问题。
    猜你喜欢
    • 1970-01-01
    • 2021-05-09
    • 2016-05-04
    • 2020-10-01
    • 1970-01-01
    • 2017-11-12
    • 2017-04-08
    • 1970-01-01
    • 2019-08-25
    相关资源
    最近更新 更多