未在kibana中为mongodb + logstash + elasticsearch创建索引

问题描述

我正在尝试使用logstash配置可视化kibana中的mongodb数据。下面是我的配置。我在终端中得到一些输出,并且它永远循环。我看不到配置文件中提到的名称创建的任何索引,并且如果生成了索引,也没有任何数据。在发现选项卡中没有结果匹配。如何进行配置以显示kibana中的数据?

 input {
            mongodb {
            uri => "mongodb+srv:@@@@@@@@@@@@@@@?retryWrites=true&w=majority"
            placeholder_db_dir => "C:/logstash-mongodb"
            placeholder_db_name => "logstash1_sqlite.db"
            collection => "logs"
            batch_size => 1
            
            
            }
    }
    filter {
    
    }
    output {
            stdout {
                    codec => rubydebug
            }
            elasticsearch {
                    action => "index"
                    index => "ayesha_logs"
                    hosts => ["localhost:9200"]
            }
    }

enter image description here

http:// localhost:9200 / ayesha_logs / _search?pretty

enter image description here

终端日志: D,[2020-10-01T08:11:45.717000#2372]调试-:MONGODB | range-api-test-cluster-shard-00-02.icqif.azure.mongodb.net:27017 req:259 conn:1:1 sconn:231839 | coexistence-poc.listCollections |已开始| {“ listCollections” => 1,“ cursor” => {},“ nameOnly” => true,“ $ db” =>“ coexistence-poc”,“ $ clusterTime” => {“ clusterTime” =>#,“ signature” => {“ hash” => “ coexistence-pinfobackfill-logs”,“ filter” => {“ _ id” => {“ $ gt” => BSON :: ObjectId('5f71f009b6b9115861d379d8')}},“ limit” => 50 ,“ $ db” =>“ coexistence-poc”,“ $ clusterTime” => {“ clusterTime” =>#,... D,[2020-10-01T08:11:50.843000#2372]调试-:MONGODB | range-api-test-cluster-shard-00-02.icqif.azure.mongodb.net:27017 req:260 |共存-poc.find |成功| 0.042秒 D,[2020-10-01T08:11:50.859000#2372]调试-:MONGODB | range-api-test-cluster-shard-00-02.icqif.azure.mongodb.net:27017 req:261 conn:1:1 sconn:231839 | coexistence-poc.listCollections |已开始| {“ listCollections” => 1,“ cursor” => {},“ nameOnly” => true,“ $ db” =>“ coexistence-poc”,“ $ clusterTime” => {“ clusterTime” =>#,“ signature” => {“ hash” =>

enter image description here

解决方法

您是否创建了Kibana的索引模式? 如果没有,只需进入菜单>堆栈管理> Kibana>索引模式

点击enter image description here

并按照步骤进行。 enter image description here

然后,您将可以在“发现”或“可视化”选项卡中使用索引。