Kibana logstash不加载数据到elasticsearch索引

dsf9zpds  于 2023-04-27  发布在  Kibana
关注(0)|答案(2)|浏览(209)

我已经在elasticsearch中创建了一个索引来存储一些测试日志,但是我无法从logstash中获取要加载的数据。我在ES中创建了索引:

put sonicwall
    {
      "mappings":{
        "properties":{
          "Time": { "type":"text"},
          "Category": { "type":"text"},
          "Group": { "type":"text"},
          "Event":{ "type":"text"},
          "Priority":{ "type":"text"}
        }
      }
    }

创建索引

现在,我的logstash配置文件:

input{
        file{
            path => "C:/Elastic/logsPrueba/log3.csv"
            start_position => beginning
        }
    }
    filter{
        csv{
            separator => ","
            columns => ["Time","Category","Group","Event","Priority"]
        }
        
    }
    output{
        
        elasticsearch{
            hosts => ["localhost:9200"]
            index => "sonicwall"
        }
        stdout {}
    }

这就是CSV

当我运行logstash时,数据永远不会加载

有人能帮帮我吗

bejyjqdl

bejyjqdl1#

检查logstash事件的统计数据,以了解问题所在。

curl -XGET 'localhost:9600/_node/stats/events?pretty'


为什么我设计的elasticsearch logstash结构中的日志没有索引?

dy1byipe

dy1byipe2#

我想我已经发现问题了。当第一次读取csv文件时,在文件的末尾保存了某种记录,然后logstash无法从头开始。我已经尝试在Windows上使用sincedb_path =“NULL”或在Linux上使用sincedb_path="/dev/null”修复它。但是logstash能够一次又一次地从头开始阅读文件。如果我添加一个新的日志行并运行logstash,只会绘制新添加的行。

相关问题