搜索结果正在快递途中

filebeat索引模板问题

Beats | 作者 zuo | 发布于2019年03月26日 | 阅读数:6749

使用6.5版本filebeat+es收集程序日志,未使用logstash,使用的pipline预处理日志。数据能够收集,都有数据,但是感觉是索引模板不对,数据格式不对。
filebeat配置如下:
filebeat.prospectors:
- input_type: log
  paths:
    - /usr/ac-julink/log/ac-julink.WARNING
  fields:
    type: "session"
    server_ip: "192.168.125.146"
  fields_under_root: true
  include_lines: ['STATUS']
  exclude_lines: ['REQ']

processors:
- drop_fields:
    fields: ["beat", "offset", "source"]

output.elasticsearch:
  hosts: ["192.168.125.146:9200"]
  index: "wg-julink-%{[type]}-%{+yyyy.MM.dd}"
  pipeline: "wg-julink-%{[type]}-pipeline"
setup.template.name: "wg-julink-session-template"
setup.template.pattern: "wg-julink-session-template-*"

setup.template.name: "wg-julink-session-template"
这个配置项不就是指定使用哪个ES的模板吗??

ES的template如下:
{
"wg-julink-session-template" : {
"order" : 0,
"index_patterns" : [
"wg-julink-session-template-*"
],
"settings" : {
"index" : {
"number_of_shards" : "5",
"number_of_replicas" : "1",
"refresh_interval" : "60s"
}
},
"mappings" : {
"doc" : {
"properties" : {
"newses" : {
"type" : "integer"
},
"delses" : {
"type" : "integer"
},
"currentses" : {
"type" : "integer"
},
"goroutine" : {
"type" : "integer"
}
}
}
},
"aliases" : { }
}
}

 
附件中显示,模板中设定的字段类型都是string。
 
 
kibana.png
已邀请:

rochy - rochy_he

赞同来自:

可能是缩进问题,试试下面的配置:
output.elasticsearch:
hosts: ["192.168.125.146:9200"]
index: "wg-julink-%{[type]}-%{+yyyy.MM.dd}"
pipeline: "wg-julink-%{[type]}-pipeline"
setup.template.name: "wg-julink-session-template"
setup.template.pattern: "wg-julink-session-template-*"

zuo - 愿有岁月可回首,且以情深共白头

赞同来自:

问题已经解决:
索引模板的index_patterns应该跟index保持一致,之前随便写个
wg-julink-session-template-* ,而index的格式是wg-julink-session-2019.03.27 根本匹配不上,导致模板不生效,感谢rochy大神的关注
 
PUT /_template/wg-julink-session-template
{

"order" : 1,
"index_patterns" : [
"wg-julink-session-*"
],

111.png

 

要回复问题请先登录注册