简体   繁体   English

Logstash MySQL数据库数据未加载到ElasticSearch索引

[英]Logstash mysql database data not loading to elasticsearch index

I have been working on this all evening and it is driving me crazy. 我整晚都在努力,这让我发疯。 It is supposed to be very simple but it is not working. 它应该很简单,但是无法正常工作。 This works with Oracle but not with MySQL and I created similar db.config that is fed to logstash using -f option. 这适用于Oracle,但不适用于MySQL,我创建了类似的db.config,使用-f选项将其送入logstash。

input {

 jdbc {
       jdbc_driver_library => "/opt/elk/logstash-5.6.0/lib/mysql-connector-java-5.1.45-bin.jar"
       jdbc_driver_class => "Java::com.mysql.jdbc.Driver"
       jdbc_connection_string => "jdbc:mysql://serverName:3306/dbName?verifyServerCertificate=false&useSSL=true"
       jdbc_user => "userName"
       jdbc_password => "PasswordValue"

    statement => "select user_id, visitor_returning, config_os, visitor_days_since_last from visiting_table where user_id is not null"

    #optional extras I use 
      type => "visit"
      tags => ["awesome", "import"]
 }

} }

output{ stdout {codec => json_lines} 输出{stdout {编解码器=> json_lines}

if [type] == "visit"{   
        elasticsearch{
            hosts => "127.0.0.1"
            index => "visitDb"
            document_type => "visit_results"
        }
    }
stdout{}

} }

Once I run the logstash, it is not loading the data into Elastic search index. 一旦我运行了logstash,它就不会将数据加载到Elastic搜索索引中。 I cannot even see the index named visitDb when I do the below. 执行以下操作时,甚至看不到名为visitDb的索引。

curl 'localhost:9200/_cat/indices?v' curl'本地主机:9200 / _cat / indices?v'

health status index          uuid                   pri rep docs.count docs.deleted store.size pri.store.size

yellow open .kibana Fg6P7XuHSTaonbKEbLcz5A 1 1 21 3 56.5kb 56.5kb yellow open orderstotdb obxZ38prTFCG0W-BFTIhgw 5 1 60 0 245.4kb 245.4kb y 黄色打开.kibana Fg6P7XuHSTaonbKEbLcz5A 1 1 21 3 56.5kb 56.5kb黄色打开orderstotdb obxZ38prTFCG0W-BFTIhgw 5 1 60 0 245.4kb 245.4kb y

I am unable to figure out what is going on with MySQL. 我无法弄清楚MySQL发生了什么。 I can see the console log retrieving the data in json format and writing to console, but the index does not reflect in ElasticSearch nor shows up in Kibana to create index pattern. 我可以看到控制台日志以json格式检索数据并将其写入控制台,但是索引不会反映在ElasticSearch中,也不会显示在Kibana中以创建索引模式。

Can someone please help ?? 有人可以帮忙吗??

Answering my own question in case any one else is having the same issue. 万一其他人遇到同样的问题,请回答我自己的问题。 Elastic Search rejects index names with upper case, since I had name visitDb with D capital, it was rejecting index name creation, go figure :) Hours lost in debugging different options. Elastic Search拒绝使用大写字母的索引名称,因为我用D大写字母命名了visitDb,所以它拒绝创建索引名称,请去图:)调试不同选项所浪费的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM