如何使用logstash配置文件在弹性中设置document_id

时间:2017-02-02 13:27:45

标签: logging elasticsearch logstash-configuration

我想使用我的日志文件以弹性方式将动态值传递给document_id。 示例 - (xx.log文件)

{"level":"info","item_id":"123","message":"Hii","timestamp":"2017-02-02T08:32:09.535Z"}

我想传递我的日志文件字段值" item_id"在我的弹性" document_id" value和我的logstash.conf输出节文件 -

output {
    stdout { codec => rubydebug }
      elasticsearch {
           host => "localhost" 
           document_id => "%{item_id}"
      }
 }

1 个答案:

答案 0 :(得分:0)

下面是应该正常工作的代码:-

select count(AccountNumber) 
from table where (EffectiveDate > '20150101' and LastChangedDate is NULL) or LastChangedDate is NOT NULL
group by AccountNumber
having AccountNumber > 1