elkjilu

1.

filebeat的下载安装配置
下载:https://www.elastic.co/cn/downloads/beats/filebeat

windows10 启动:在安装包解压目录下

filebeat -e -c filebeat.yml

2.配置文件调整

filebeat.yml
启动当前配置
enabled: true

多行配置

multiline.pattern: ^\[

multiline.negate: true

multiline.match: after

#不会从头读取日志,而是从尾部读取,等价于tail (tail -f)
tail_files: true

 

#==================== Elasticsearch template setting ==========================
#setup.template 区域指定索引的模板 用来设置ES的映射
#模板的名称
setup.template.name: boling-ad-server
#模板的模式
setup.template.pattern: boling-ad-server-*
#kinana 索引的配置
setup.dashboards.index: boling-ad-server-*
#描述字段的YAML文件路径(发送到ES的字段定义),使用filebeat自带的
setup.template.field: fields.yml

setup.template.settings:
#索引分区个数的定义,与ES的优化相关
index.number_of_shards: 3

 

 

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# Array of hosts to connect to.
#ES主机地址,即使是集群也可以配置一个,最好全部配置
hosts: ["localhost:9200"]

#ES数据索引的定义,也就是将数据发送到哪个索引中去(ES 索引)
index: "ad-server-%{+yyyy.MM.dd}"

 

 ES pipeline :

PUT请求:localhost:9200/_ingest/pipeline/boing-ad-log1

{
"description": "boing-ad-log1",
"processors": [
{
"grok": {
"field": "message",
"patterns":
["\\[%{TIMESTAMP_ISO8601:log_time}\\] %{NOTSPACE:thread} %{NOTSPACE:log_level} %{NOTSPACE:java_class} %{NOTSPACE:code_line} - %{GREEDYDATA:content}"]

}
},
{
"date":{
"field":"log_time",
"formats":["yyyy-MM-dd HH:mm:ss:SSS"],
"timezone":"Asia/Shanghai",
"target_field":"@timestamp"
}
}
]
}

返回结果:

{
"acknowledged": true
}
 
filebeat.yml 添加pipeline
pipeline: "boing-ad-log1"

 

 


kibana 配置文件调整

  kibana.yml:elasticsearch.hosts: ["http://localhost:9200"]

kibana 启动:在安装包解压目录下
.\bin\kibana
posted @ 2019-08-22 14:18  yu_fly  阅读(120)  评论(0)    收藏  举报