Grafana Loki与ELK对比:日志聚合与查询成本
概览
- Loki 采用标签索引与内容对象存储;ELK 采用全文索引;两者在成本与能力上有不同取舍。
技术参数(已验证)
- 索引模型:Loki 仅索引标签,内容存对象存储;ELK 建全文索引与字段。
- 查询:Loki LogQL(过滤标签与内容);ELK DSL(全文/聚合);对搜索与分析能力不同。
- 成本与性能:Loki 成本低适合大规模日志;ELK 查询强但索引与存储成本高。
- 生态与集成:Loki 与 Prometheus/Tempo协同;ELK 生态成熟与插件丰富。
- 运维:Loki 简化组件;ELK 需维护集群与索引生命周期。
实战清单
- 按场景选择:监控与排错优先 Loki,搜索与复杂分析选择 ELK。
- 统一标签策略与保留周期;控制成本与性能。
- 建立日志查询画像与基准;持续优化。
基本
文件
流程
错误
SQL
调试
- 请求信息 : 2026-09-28 05:35:26 HTTP/2.0 GET : www.ybb.press/hardware/1887.html
- 运行时间 : 0.342580s [ 吞吐率:2.92req/s ] 内存消耗:5,316.46kb 文件加载:115
- 查询信息 : 19 queries 2 writes
- 缓存信息 : 36 reads,3 writes
- 配置加载 : 80
- 会话信息 : SESSION_ID=nvm3emkup96seu7afn8af6uo20
- [ BEHAVIOR ] Run Closure @app_init [ RunTime:0.000085s ]
- [ CACHE ] INIT File
- [ BEHAVIOR ] Run \addons\cms\Cms @app_init [ RunTime:0.009009s ]
- [ BEHAVIOR ] Run \addons\fastchat\Fastchat @app_init [ RunTime:0.000171s ]
- [ BEHAVIOR ] Run \addons\log\Log @app_init [ RunTime:0.000391s ]
- [ BEHAVIOR ] Run \addons\shop\Shop @app_init [ RunTime:0.003452s ]
- [ BEHAVIOR ] Run \addons\yunping\Yunping @app_init [ RunTime:0.000461s ]
- [ BEHAVIOR ] Run Closure @app_init [ RunTime:0.000588s ]
- [ BEHAVIOR ] Run app\common\behavior\Common @app_init [ RunTime:0.001367s ]
- [ LANG ] /www/wwwroot/yebinbing/thinkphp/lang/zh-cn.php
- [ BEHAVIOR ] Run app\common\behavior\Common @app_dispatch [ RunTime:0.000103s ]
- [ ROUTE ] array (
'type' => 'method',
'method' =>
array (
0 => '\\think\\addons\\Route',
1 => 'execute',
),
'var' =>
array (
'addon' => 'cms',
'controller' => 'archives',
'action' => 'index',
),
)
- [ HEADER ] array (
'x-forwarded-proto' => 'https',
'cf-visitor' => '{"scheme":"https"}',
'cf-ipcountry' => 'US',
'cf-connecting-ip' => '216.73.216.103',
'cdn-loop' => 'cloudflare; loops=1',
'user-agent' => 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])',
'accept-encoding' => 'gzip, br',
'accept' => '*/*',
'cf-ray' => 'a41da3650de3a151-CMH',
'x-forwarded-for' => '216.73.216.103',
'host' => 'www.ybb.press',
'content-length' => '',
'content-type' => '',
)
- [ PARAM ] array (
'catename' => 'hardware',
'id' => '1887',
)
- [ RUN ] think\addons\Route->execute[ /www/wwwroot/yebinbing/vendor/fastadminnet/fastadmin-addons/src/addons/Route.php ]
- [ LANG ] /www/wwwroot/yebinbing/public/../application/common/lang/zh-cn/addon.php
- [ BEHAVIOR ] Run app\common\behavior\Common @addon_begin [ RunTime:0.004202s ]
- [ LANG ] /www/wwwroot/yebinbing/addons/cms/lang/zh-cn.php
- [ DB ] INIT mysql
- [ VIEW ] /www/wwwroot/yebinbing/addons/cms/view/default/show_article.html [ array (
0 => 'config',
1 => 'user',
2 => 'site',
3 => '__CHANNEL__',
4 => 'isWechat',
5 => 'canonical_url',
6 => '__ARCHIVES__',
7 => '__MODEL__',
) ]
- [ SESSION ] INIT array (
'id' => '',
'var_session_id' => '',
'prefix' => 'think',
'type' => '',
'auto_start' => true,
)
- [ BEHAVIOR ] Run \addons\cms\Cms @view_filter [ RunTime:0.000393s ]
- [ BEHAVIOR ] Run \addons\shop\Shop @view_filter [ RunTime:0.000108s ]

0.345177s
发表评论 取消回复