SQL 服务器通过 Logstash 与 Elasticsearch 同步 - 不会发生重新传输

SQL Server Sync with Elasticsearch through Logstash - retransfer does not happens

背景: 我们正在进行同步 SQL 服务器错误日志数据到 elasticsearch(ES) 的 POC,以便在 kibana 中引入仪表板。 我使用带有 jdbc 输入插件的 Logstash 将 sql 服务器 table 数据移动到 (ES),它成功了。在日志中 table 大约有 5000 条记录,每条记录都已移至 ES。

问题陈述: 为了进行测试,我从 ES 中删除了之前由 Logstash 同步的索引,然后我再次使用相同的输入配置文件 运行 Logstash。但是没有记录被移动如果我向 SQL 服务器 table 添加一条新记录,那是反映,但旧记录 (5000) 没有更新。

配置 下面是我用来同步的配置文件

input {
  jdbc {
    #https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html#plugins-inputs-jdbc-record_last_run
    jdbc_connection_string => "jdbc:sqlserver://localhost:40020;database=application;user=development;password=XXX$"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"    

    jdbc_user => nil
        # The path to our downloaded jdbc driver
    jdbc_driver_library => "C:\Program Files (x86)\sqljdbc6.2\enu\sqljdbc4-3.0.jar"
        # The name of the driver class for SqlServer
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
        # Query for testing purpose     
    schedule => "* * * * *"
    last_run_metadata_path => "C:\Software\ElasticSearch\logstash-6.4.0\.logstash_jdbc_last_run"
    record_last_run => true
    clean_run => true
    statement => "  select * from Log"  

  }
}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "application_log"
    #document_id is a unique id, this has to be provided during syn, else we may get duplicate entry in ElasticSearch index.
    document_id => "%{Id}"
  }
}

请帮我解释一下哪里出了问题。

Logstash Version:6.4.0 弹性搜索版本:6.3.1

提前致谢

我发现并解决了这个问题。

我发现的问题是每个字段都区分大小写,它只接受 小写 字母。

下面是我所做的更改,对我来说效果很好。

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "application_log"
    #document_id is a unique id, this has to be provided during syn, else we may get duplicate entry in ElasticSearch index.
    document_id => "%{Id}"
  }
}

输入部分没有变化。

感谢您的支持。