(十六):ELFK日志收集系统
1、环境准备
1.1、安装部署ES
1.2、安装部署FileBeat
参考:(十五):FileBeat。
1.3、安装部署Kibana
参考:(三):Kibana安装。
1.4、安装部署Logstash
参考:(十三):Logstash安装。
2、配置
1.1、FileBeat配置
修改filebeat.yml配置如下:
# 输入配置
filebeat.inputs:
# 指定类型为log
- type: log
enabled: true
# 指定监控要监控的日志文件的路径
paths:
- D:\development\Elasticsearch\elasticsearch-7.10.0\logs\*.log
# 指定kibana所在主机的ip和服务监听的端口
setup.kibana:
host: "localhost:5601"
# 指定es所在主机的ip以及服务监听的端口
output.elasticsearch:
hosts: ["localhost:9200"]
1.2、Logstash配置
修改logstash.conf配置如下:
# 数据源从后台端口服务中获取,beats(filebeats)中上传读取的
input {
beats {
port => 5044
}
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "es_%{+YYYYMMdd}"
}
stdout { codec => rubydebug }
}
1.3、Kibana配置
修改kibana.yml配置如下:
# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch.hosts: ["http://localhost:9200"]
3、启动
注意启动顺序。
3.1、ES启动
Windows系统,点击解压目录下的elasticsearch.bat文件即可。

启动详情如下:

3.2、Kibana启动
Windows系统,点击解压目录下的kibana.bat文件即可。

启动详情如下:

3.5、Logstash启动
Windows系统,在解压目录中执行 logstash -f logstash.conf 命令即可。

启动详情如下:

3.4、Filebeat启动
Windows系统,在解压目录中执行 .\filebeat -e -c filebeat.yml 命令即可。

Filebeat启动成功,详情如下:

ES日志详情如下:

Logstash日志详情如下:

4、Kibana设置查看收集日志
4.1、查看创建的索引

4.2、创建索引模式

4.3、Distory查看日志详情


查看关键的日志信息:

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)