1.什么是elkelk安装步骤
elk不是一款软件,是一套解决方案,是三个软件首字母
elasticseach: 负责日志检索和存储,是一个开源分布式的搜索引擎,特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载等等;
logstash:一个完全开源的的工具,他可以对日志进行收集、过滤,存储;
2.logstash(filebeat)kibana: 是一个开源免费的工具,kibana可以为logstash和 elastic提供日志分析的Web界面。
filebeat.yml配置
在filebeat.input中的配置:
paths: xx.log(日志文件路径)
type: “xxx”(创建一个新字段)
pipeline: “xxx-xx-xx”(填写对应的预处理)index: “xxxx”(创建inde)
使用index需要加上一下两行代码(不然会报错)
setup.template.name: "indexcx-%{[agent.version]}" setup.template.pattern: "indexcx-%{[agent.version]}-*"
fileabeat.input:
- type: log
# Change to true to enable this input configuration.
enabled: true
# Paths that should be crawled and fetched. Glob based paths.
paths:
- D:gitll.log
multiline.pattern: 'hello'
multiline.negate: true
multiline.match: after
fields:
type: "ghs"
index: "indexcx-%{[agent.version]}-%{[fields.type]:other}-%{+yyyy.MM.dd}"
pipeline: "ghs-log-cs"
连接kibana
host: “xxx”(需要连接的kibana地址)
setup.kibana: host: "174.34.93.62:5601"
连接elasticseach
hosts: “xxxxxx”
output.elasticsearch: hosts:["174.34.93.62:5601"]pipeline使用
pipeline主要是对日志数据进行预处理,使得传入elastic显示在kibana的数据和显示格式是我们预期的。
hightec日志文件使用的pipeline(上图)
ghs日志文件使用的pipeline(上图)
在创建index前需要执行以下代码
所有操作完成后,开始启动fiebeat
运行需要开启管理员权限
进到filebeat目录下
启动filebeat: .filebeat.exe setup Start-Service filebeat 停止: stop-Service filebeat
pipeline如何实现预处理的?
我们使用的是filebeat上面写到pipeline是在filebeat.yml配置文件中配置,注意配置的pipeline名称需要和创建的pipeline名称一致(大小写)
添加pipeline日志数据传入失败是为什么?
如何在filebeat.yml里配置了pipelien启动filebeat后查看kibana数据未添加成功大概率是pipeline的grok表达式和日志文件内容不匹配添加失败



