output部分
这里就是很简单往es中发送数据
output { elasticsearch { embedded => false protocol => "http" host => "localhost" port => "9200" user => "yejianfeng" password => "yejianfeng" }}
这里有个user和password,其实elasticsearch加上shield就可以强制使用用户名密码登录了。这里的output就是配置这个使用的。
查询elasticsearch
比如上面的例子,我要查询某段时间的params.source(其实是source参数,但是前面的params是前缀)调用情况
$url = 'http://xx.xx.xx.xx:9200/logstash-*/_search';$filter = '{ "query": { "range" : { "@timestamp" : { "gt" : 123213213213, "lt" : 123213213213 } } }, "aggs" : { "group_by_source" : {"terms" : {"field" : "params.source"}} }, "size": 0}';