栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

ELK 介绍,安装及使用

ELK 介绍,安装及使用

安装

elk安装步骤

1.什么是elk

elk不是一款软件,是一套解决方案,是三个软件首字母

elasticseach: 负责日志检索和存储,是一个开源分布式的搜索引擎,特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载等等;

logstash:一个完全开源的的工具,他可以对日志进行收集、过滤,存储;

kibana: 是一个开源免费的工具,kibana可以为logstash和 elastic提供日志分析的Web界面。

2.logstash(filebeat)

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表达式和日志文件内容不匹配添加失败

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/752505.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号