当前位置:网站首页>轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
2022-06-22 12:13:00 【InfoQ】
Fluentd
一、整合架构
- Kibana + ElasticSearch + Fluentd
- Minio + Fluentd
一般类型插件
二、插件原理分析
三、EFK 日志收集实践
3.1 操作步骤
- 对接开源应用商店
- 在应用商店中搜索
elasticsearch并安装7.15.2版本。
- 团队视图 -> 插件 -> 从应用商店安装
Fluentd-ElasticSearch7插件
- 基于镜像创建组件,镜像使用
nginx:latest,并且挂载存储var/log/nginx。这里使用Nginx:latest作为演示在组件内挂载存储后,插件也会自定挂载该存储,并可访问 Nginx 产生的日志文件。
- 在 Nginx 组件内开通插件,可以根据所需进行修改
Fluentd配置文件,可参考下方配置文件简介部分。

- 添加 ElasticSearch 依赖,将 Nginx 连接到 ElasticSearch,如下图:

- 访问
Kibana面板,进入到 Stack Management -> 数据 -> 索引管理,可以看到已存在的索引名称为fluentd.es.nginx.log,
- 访问
Kibana面板,进入到 Stack Management -> Kibana -> 索引模式,创建索引模式。
- 进入到 Discover,日志正常展示。

3.2 配置文件介绍
<source>
@type tail
path /var/log/nginx/access.log,/var/log/nginx/error.log
pos_file /var/log/nginx/nginx.access.log.pos
<parse>
@type nginx
</parse>
tag es.nginx.log
</source>
<match es.nginx.**>
@type elasticsearch
log_level info
hosts 127.0.0.1
port 9200
user elastic
password elastic
index_name fluentd.${tag}
<buffer>
chunk_limit_size 2M
queue_limit_length 32
flush_interval 5s
retry_max_times 30
</buffer>
</match>
四、Fluentd + Minio 日志收集实践
4.1 操作步骤
- 对接开源应用商店。在开源应用商店中搜索
minio,并安装22.06.17版本。
- 团队视图 -> 插件 -> 从应用商店安装
Fluentd-S3插件。
- 访问 Minio 9090 端口,用户密码在 Minio 组件 -> 依赖中获取。
- 创建 Bucket,自定义名称。
- 进入 Configurations -> Region,设置 Service Location
- Fluentd 插件的配置文件中
s3_region默认为en-west-test2。
- 基于镜像创建组件,镜像使用
nginx:latest,并且挂载存储var/log/nginx。这里使用Nginx:latest作为演示 - 在组件内挂载存储后,插件也会自定挂载该存储,并可访问 Nginx 产生的日志文件。
- 进入到 Nginx 组件内,开通 Fluentd S3 插件,修改配置文件中的
s3_buckets3_region

- 建立依赖关系,Nginx 组件依赖 Minio,更新组件使其生效。

- 访问 Nginx 服务,让其产生日志,片刻后就可以在 Minio 的 Bucket 中看到。

4.2 配置文件介绍
<source>
@type tail
path /var/log/nginx/access.log
pos_file /var/log/nginx/nginx.access.log.pos
tag minio.nginx.access
<parse>
@type nginx
</parse>
</source>
<match minio.nginx.**>
@type s3
aws_key_id "#{ENV['MINIO_ROOT_USER']}"
aws_sec_key "#{ENV['MINIO_ROOT_PASSWORD']}"
s3_endpoint http://127.0.0.1:9000/
s3_bucket test
s3_region en-west-test2
time_slice_format %Y%m%d%H%M
force_path_style true
path logs/
<buffer time>
@type file
path /var/log/nginx/s3
timekey 1m
timekey_wait 10s
chunk_limit_size 256m
</buffer>
</match>
最后
Flunetd-S3Flunetd-ElasticSearch7参考资料
边栏推荐
- 微信公众号开发注意事项
- Getting started with fluent Animation: inner and outer reverse ring loading animation
- MySQL_ Addition, deletion and modification of data processing
- How to improve customer conversion rate on the official website
- SICF批量激活服务节点
- Flutter mixed development exercise - large picture of collaborative loading of ever & method channel
- 2022-6-21os review group linking method
- MySQL_ Create and manage tables
- Flutter - realize progressive card switching of Netease cloud music
- SequoiaDB分布式数据库2022.5月刊
猜你喜欢

Tis tutorial 01- installation

推荐一款M1芯片电脑快速搭建集群的虚拟机软件

巨杉数据库受邀出席鲲鹏开发者年度盛会2022,共建国产化数字底座

SAP 客户端中文显示乱码问题

Flutter&Flame——TankCombat游戏手柄开发(一)

Parallels Desktop 17.1.4pd virtual machine

Under Xinchuang: when the domestic database stars shine

Shutter & flame - tankcombat game console development (I)

Flutter -- realize the tabbar switching effect of Netease cloud music

Parallels Desktop 17.1.4pd虚拟机
随机推荐
银行支付接口开发之子账户
Isn't this another go bug?
Parallels Desktop 17.1.4pd virtual machine
Flutter imitates airbnb's price range filter. (I)
企业官网如何提高客户转化率
帝云CMS升级PHP8注意事项
Correct posture of MySQL executing script
Flutter:剥离StatefulWidget——简化页面开发、跳转以及传值
Flutter——实现网易云音乐的渐进式卡片切换
SAP 系统License查看申请及导入
Ffmpeg converts AMR format to MP3 format
定金预售的规则思路详解
Flutter动画入门: 内外逆向环Loading动画
【mysql】where 和 having 的区别
MySQL_ Create and manage tables
信创之下:国产数据库群星闪耀时
第十二届 蓝桥杯 嵌入式设计与开发项目 决赛
Help financial informatization innovation, Jushan database has won more than 50 financial customers recently
Flutter&Flame——TankCombat游戏手柄开发(一)
uboot do_ Load function analysis