如何使用Filebeat+Easysearch+Console搭建日志管理平台
本文主要讲解关于如何使用Filebeat+Easysearch+Console搭建日志管理平台相关内容,让我们来一起学习下吧!
近年来,日志管理平台越来越流行。使用日志管理平台可以实时地、统一地、方便地管理和查看日志,挖掘日志数据价值,驱动运维、运营,提升服务管理效率。
方案架构
- Beats 是轻量级采集器,包括 Filebeat、Metricbeat 等。
- Easysearch 是个分布式搜索引擎,提供搜集、分析、存储数据等主要功能。
- Console 是一个可视化工具,提供可视化查询,制作报表等功能。
本文将搭建一个统一日志管理平台。使用 Filebeat 采集 OS 中的日志(其他日志大同小异),发送到 Easysearch 中。最后通过 Console 进行日志的可视化查询与分析。
操作步骤
- 准备工作
- 部署 Easysearch
- 编辑 easysearch.yml 文件,打开注释 elasticsearch.api_compatibility: true
- 部署 Console
- 部署 Easysearch
- 安装并配置 Filebeat
- 下载 Filebeat,版本建议选择 7.10.2,点此下载
- 修改配置 filebeat.yml 文件
setup.template.name: "filebeat" setup.template.pattern: "system-log*" setup.template.fields: "${path.config}/fields.yml" output.elasticsearch: hosts: ["localhost:9200"] protocol: "https" ssl.verification_mode: none username: "admin" password: "4ad8f8f792e81cd0a6de" index: "system-log"
3. 启用 system 模块并导入 pipeline
./filebeat modules enable system
./filebeat setup --pipelines --modules system
- 创建索引模板及初始索引,使用 ZSTD+SOURCE_REUSE 技术节省磁盘空间
PUT _template/system_log { "order": 100, "index_patterns": [ "system_log*" ], "settings": { "index": { "format": "7", "lifecycle": { "name": "ilm_.infini_metrics-30days-retention", "rollover_alias": "system_log" }, "codec": "ZSTD", "source_reuse": true, "number_of_shards": "1", "translog": { "durability": "async" } } }, "mappings": { "dynamic_templates": [ { "strings": { "mapping": { "ignore_above": 256, "type": "keyword" }, "match_mapping_type": "string" } } ] } } PUT system-log-00001 { "aliases":{ "system-log":{ "is_write_index":true } } }
5. 启动 filebeat
nohup ./filebeat -c filebeat.yml 2>&1>/dev/null &
6.进入 Console 查看、搜索日志
7.进入 Console 创建 dashboard 进行日志分析
以上就是关于如何使用Filebeat+Easysearch+Console搭建日志管理平台相关的全部内容,希望对你有帮助。欢迎持续关注潘子夜个人博客,学习愉快哦!