使用Grafana+Loki+Promtail入门级部署分布式日志系统(windows环境)
生命不息 , 写作不止 继续踏上学习之路 , 学之分享笔记 总有一天我也能像各位大佬一样 一个有梦有戏的人 @怒放吧德德分享学习心得 , 欢迎指正 , 大家一起学习成长!

文章插图
目录
- 使用Grafana+Loki+Promtail入门级部署分布式日志系统(windows环境)- 简介
- 1、安装grafana
- 2、安装loki
- 3、安装promtail
- 4、使用Grafana+loki+promtail查看日志
 
1、安装grafana
- 下载地址:https://grafana.com/grafana/download?platform=windows
- 下载grafana-9.0.6.windows-amd64.zip安装包即可 , 并解压到F:\softwarea\grafana\grafana-9.0.6
- 进入 bin 目录 , 双击grafana-server.exe启动
- 启动成功之后 , http://localhost:3000
- 初始登录账户:admin/admin

文章插图
2、安装loki下载地址:https://github.com/grafana/loki/releases下载loki-windows-amd64.exe.zip安装包 , 并进行解压到F:\soft\grafana\logmanager , 解压得到loki-windows-amd64.exe在F:\soft\grafana\logmanager目录下添加loki-local-config.yaml文件 , 内容如下
auth_enabled: falseserver:http_listen_port: 3100ingester:lifecycler:address: 127.0.0.1ring:kvstore:store: inmemoryreplication_factor: 1final_sleep: 0schunk_idle_period: 5mchunk_retain_period: 30smax_transfer_retries: 0schema_config:configs:- from: 2022-08-06store: boltdbobject_store: filesystemschema: v11index:prefix: index_period: 672h #每张表的时间范围28天storage_config:boltdb:directory: /tmp/loki/index # 索引文件存储地址filesystem:directory: /tmp/loki/chunks # 块存储地址limits_config:enforce_metric_name: falsereject_old_samples: truechunk_store_config:max_look_back_period: 24h # 最大可查询历史日期 28天,这个时间必须是schema_config中的period的倍数 , 否则报错 。table_manager: # 配置保留多少天的数据 , 那么之前数据会被清除 , Loki中默认保留所有数据retention_deletes_enabled: trueretention_period: 24h打开cmd定位到exe目录 , 执行命令:.\loki-windows-amd64.exe --config.file=loki-local-config.yaml , loki服务启动成功配置通信端口号:server:http_listen_port: 3200 # http访问端口grpc_listen_port: 9096 # 通信端口启动: .\loki-windows-amd64.exe --config.file=loki-local-config.yaml3、安装promtail下载地址:https://github.com/grafana/loki/releases下载promtail-windows-amd64.exe.zip安装包 , 并解压到F:\soft\grafana\promtail目录 , 得到promtail-windows-amd64.exe在F:\soft\grafana\promtail目录下添加promtail-local-config.yaml文件 , 内容如下server:http_listen_port: 9080grpc_listen_port: 0positions:filename: /tmp/positions.yamlclients:- url: http://localhost:3100/loki/api/v1/pushscrape_configs:- job_name: systemstatic_configs:- targets:- localhostlabels:job: viplogs__path__: F:\soft\grafana\testlogs\*.log- job_name: systemstatic_configs:- targets:- localhostlabels:job: viplogs__path__: F:\soft\grafana\testlogs\*.log打开cmd定位到exe目录 , 执行命令: .\promtail-windows-amd64.exe --config.file=promtail-local-config.yaml , loki服务启动成功 。
		  	经验总结扩展阅读
- 快递柜怎么取件
- 韭菜盒子和面小窍门
- .net core Blazor+自定义日志提供器实现实时日志查看器
- 西瓜皮糖不挂霜的原因
- 榴莲可以放锅里蒸热了吃吗
- 厚礼谢是什么梗
- 2023年9月23日是生孩子的黄道吉日吗 2023年9月23日生孩子好不好
- 恐龙怎么灭绝的?为什么?
- 西瓜怎么挑选
- 2023年9月23日珠宝开光行吗 2023年9月23日珠宝开光黄道吉日

 
   
   
   
   
   
   
   
   
   
   
   
  