loki
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGrafana Loki Skill
Grafana Loki 全面指南
Comprehensive guide for Grafana Loki - the cost-effective, horizontally-scalable log aggregation system inspired by Prometheus.
这是一份关于Grafana Loki的综合指南,它是受Prometheus启发的高性价比、可水平扩展的日志聚合系统。
What is Loki?
什么是Loki?
Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system that:
- Indexes only metadata (labels) - Not full log content like traditional systems
- Stores compressed chunks in affordable object storage (S3, GCS, Azure Blob)
- Uses Prometheus-style labels for organizing log streams
- Multi-tenant by default with built-in tenant isolation
- Cost-efficient - Dramatically smaller index and lower operational costs
Loki是一款可水平扩展、高可用、多租户的日志聚合系统,具备以下特性:
- 仅索引元数据(标签) - 不像传统系统那样索引完整日志内容
- 以压缩块形式存储在低成本对象存储(S3、GCS、Azure Blob)中
- 采用Prometheus风格标签组织日志流
- 默认支持多租户,内置租户隔离机制
- 成本高效 - 索引体积大幅缩小,运维成本更低
Architecture Overview
架构概述
Core Components
核心组件
| Component | Purpose |
|---|---|
| Distributor | Validates requests, preprocesses labels, routes to ingesters |
| Ingester | Buffers logs in memory, compresses into chunks, writes to storage |
| Querier | Executes LogQL queries from ingesters and storage |
| Query Frontend | Accelerates queries via splitting, caching, scheduling |
| Query Scheduler | Manages per-tenant query queues for fairness |
| Index Gateway | Serves index queries for TSDB stores |
| Compactor | Merges index files, manages retention, handles deletion |
| Ruler | Evaluates alerting and recording rules |
| 组件 | 用途 |
|---|---|
| Distributor | 验证请求、预处理标签、将请求路由至Ingester |
| Ingester | 在内存中缓冲日志,压缩为块,写入存储 |
| Querier | 从Ingester和存储中执行LogQL查询 |
| Query Frontend | 通过拆分、缓存、调度加速查询 |
| Query Scheduler | 管理每个租户的查询队列,确保公平性 |
| Index Gateway | 为TSDB存储提供索引查询服务 |
| Compactor | 合并索引文件、管理日志保留、处理删除请求 |
| Ruler | 评估告警与记录规则 |
Data Flow
数据流
Write Path:
Log Source → Distributor → Ingester → Object Storage
↓
Chunks + IndexesRead Path:
Query → Query Frontend → Query Scheduler → Querier
↓
Ingesters + Storage写入路径:
日志源 → Distributor → Ingester → 对象存储
↓
日志块 + 索引读取路径:
查询 → Query Frontend → Query Scheduler → Querier
↓
Ingesters + 存储Deployment Modes
部署模式
1. Monolithic Mode (-target=all
)
-target=all1. 单体模式 (-target=all
)
-target=all- All components in single process
- Best for: Initial experimentation, small-scale (~20GB logs/day)
- Simplest approach
- 所有组件运行在单个进程中
- 最佳适用场景:初始实验、小规模场景(约20GB日志/天)
- 最简单的部署方式
2. Simple Scalable Deployment (SSD) - Recommended Default
2. 简单可扩展部署(SSD)- 推荐默认模式
yaml
deploymentMode: SimpleScalable
write:
replicas: 3 # Distributor + Ingester
read:
replicas: 2 # Query Frontend + Querier
backend:
replicas: 2 # Compactor + Index Gateway + Query Scheduler + Ruleryaml
deploymentMode: SimpleScalable
write:
replicas: 3 # Distributor + Ingester
read:
replicas: 2 # Query Frontend + Querier
backend:
replicas: 2 # Compactor + Index Gateway + Query Scheduler + Ruler3. Microservices Mode (Distributed)
3. 微服务模式(分布式)
yaml
deploymentMode: Distributed
ingester:
replicas: 3
zoneAwareReplication:
enabled: true
distributor:
replicas: 3
querier:
replicas: 3
queryFrontend:
replicas: 2
queryScheduler:
replicas: 2
compactor:
replicas: 1
indexGateway:
replicas: 2yaml
deploymentMode: Distributed
ingester:
replicas: 3
zoneAwareReplication:
enabled: true
distributor:
replicas: 3
querier:
replicas: 3
queryFrontend:
replicas: 2
queryScheduler:
replicas: 2
compactor:
replicas: 1
indexGateway:
replicas: 2Schema Configuration
架构配置
Recommended: TSDB with Schema v13
yaml
loki:
schemaConfig:
configs:
- from: "2024-04-01"
store: tsdb
object_store: azure # or s3, gcs
schema: v13
index:
prefix: loki_index_
period: 24h推荐:TSDB + Schema v13
yaml
loki:
schemaConfig:
configs:
- from: "2024-04-01"
store: tsdb
object_store: azure # 或 s3, gcs
schema: v13
index:
prefix: loki_index_
period: 24hStorage Configuration
存储配置
Azure Blob Storage (Recommended for Azure)
Azure Blob 存储(Azure环境推荐)
yaml
loki:
storage:
type: azure
bucketNames:
chunks: loki-chunks
ruler: loki-ruler
admin: loki-admin
azure:
accountName: <storage-account-name>
# Option 1: User-Assigned Managed Identity (Recommended)
useManagedIdentity: true
useFederatedToken: false
userAssignedId: <identity-client-id>
# Option 2: Account Key (Dev only)
# accountKey: <account-key>
requestTimeout: 30syaml
loki:
storage:
type: azure
bucketNames:
chunks: loki-chunks
ruler: loki-ruler
admin: loki-admin
azure:
accountName: <storage-account-name>
# 选项1:用户分配的托管标识(推荐)
useManagedIdentity: true
useFederatedToken: false
userAssignedId: <identity-client-id>
# 选项2:账户密钥(仅开发环境使用)
# accountKey: <account-key>
requestTimeout: 30sAWS S3
AWS S3
yaml
loki:
storage:
type: s3
bucketNames:
chunks: my-loki-chunks-2024
ruler: my-loki-ruler-2024
admin: my-loki-admin-2024
s3:
endpoint: s3.us-east-1.amazonaws.com
region: us-east-1
# Use IAM roles or access keys
accessKeyId: <access-key>
secretAccessKey: <secret-key>
s3ForcePathStyle: falseyaml
loki:
storage:
type: s3
bucketNames:
chunks: my-loki-chunks-2024
ruler: my-loki-ruler-2024
admin: my-loki-admin-2024
s3:
endpoint: s3.us-east-1.amazonaws.com
region: us-east-1
# 使用IAM角色或访问密钥
accessKeyId: <access-key>
secretAccessKey: <secret-key>
s3ForcePathStyle: falseGoogle Cloud Storage
Google Cloud Storage
yaml
loki:
storage:
type: gcs
bucketNames:
chunks: my-loki-gcs-bucket
gcs:
bucketName: my-loki-gcs-bucket
# Uses Workload Identity or service accountyaml
loki:
storage:
type: gcs
bucketNames:
chunks: my-loki-gcs-bucket
gcs:
bucketName: my-loki-gcs-bucket
# 使用工作负载身份或服务账户Chunk Configuration Best Practices
日志块配置最佳实践
yaml
loki:
ingester:
chunk_encoding: snappy # Recommended (fast + efficient)
chunk_target_size: 1572864 # ~1.5MB compressed
max_chunk_age: 2h # Max time before flush
chunk_idle_period: 30m # Flush idle chunks
flush_check_period: 30s
flush_op_timeout: 10m| Setting | Recommended | Purpose |
|---|---|---|
| snappy | Best speed-to-compression balance |
| 1.5MB | Target compressed chunk size |
| 2h | Limits memory and data loss exposure |
| 30m | Flushes inactive streams |
yaml
loki:
ingester:
chunk_encoding: snappy # 推荐(速度与效率平衡)
chunk_target_size: 1572864 # ~1.5MB 压缩后大小
max_chunk_age: 2h # 刷新前的最长时间
chunk_idle_period: 30m # 刷新闲置日志块
flush_check_period: 30s
flush_op_timeout: 10m| 设置项 | 推荐值 | 用途 |
|---|---|---|
| snappy | 最佳的速度与压缩比平衡 |
| 1.5MB | 压缩后日志块的目标大小 |
| 2h | 限制内存占用和数据丢失风险 |
| 30m | 刷新不活跃的日志流 |
Limits Configuration
限制配置
yaml
loki:
limits_config:
# Retention
retention_period: 744h # 31 days
# Ingestion limits
ingestion_rate_mb: 50
ingestion_burst_size_mb: 100
per_stream_rate_limit: 3MB
per_stream_rate_limit_burst: 15MB
# Query limits
max_query_series: 10000
max_query_lookback: 720h
max_entries_limit_per_query: 10000
# Required for OTLP
allow_structured_metadata: true
volume_enabled: true
# Sample rejection
reject_old_samples: true
reject_old_samples_max_age: 168h # 7 days
max_label_names_per_series: 25yaml
loki:
limits_config:
# 日志保留
retention_period: 744h # 31天
# 写入限制
ingestion_rate_mb: 50
ingestion_burst_size_mb: 100
per_stream_rate_limit: 3MB
per_stream_rate_limit_burst: 15MB
# 查询限制
max_query_series: 10000
max_query_lookback: 720h
max_entries_limit_per_query: 10000
# OTLP 所需配置
allow_structured_metadata: true
volume_enabled: true
# 样本拒绝
reject_old_samples: true
reject_old_samples_max_age: 168h # 7天
max_label_names_per_series: 25Compactor Configuration
压缩器配置
yaml
loki:
compactor:
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 50
compaction_interval: 10m
delete_request_store: azure # Match your storage typeyaml
loki:
compactor:
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 50
compaction_interval: 10m
delete_request_store: azure # 匹配你的存储类型Caching Configuration
缓存配置
Recommended: Separate Memcached instances
yaml
undefined推荐:使用独立的Memcached实例
yaml
undefinedHelm values for Loki caching
Loki 缓存的Helm配置
memcached:
Results cache
frontend:
replicas: 3
memcached:
maxItemMemory: 1024 # 1GB
maxItemSize: 5m
connectionLimit: 1024
Chunks cache
chunks:
replicas: 3
memcached:
maxItemMemory: 4096 # 4GB
maxItemSize: 2m
connectionLimit: 1024
memcached:
结果缓存
frontend:
replicas: 3
memcached:
maxItemMemory: 1024 # 1GB
maxItemSize: 5m
connectionLimit: 1024
日志块缓存
chunks:
replicas: 3
memcached:
maxItemMemory: 4096 # 4GB
maxItemSize: 2m
connectionLimit: 1024
Enable caching in Loki config
在Loki配置中启用缓存
loki:
chunk_store_config:
chunk_cache_config:
memcached_client:
host: loki-memcached-chunks.monitoring.svc
service: memcached-client
undefinedloki:
chunk_store_config:
chunk_cache_config:
memcached_client:
host: loki-memcached-chunks.monitoring.svc
service: memcached-client
undefinedLogQL Query Language
LogQL 查询语言
Basic Queries
基础查询
logql
undefinedlogql
undefinedStream selector
流选择器
{job="api-server"}
{job="api-server"}
Multiple labels
多标签
{job="api-server", env="prod"}
{job="api-server", env="prod"}
Label matchers
标签匹配器
{namespace=~".*-prod"} # Regex match
{level!="debug"} # Not equal
{namespace=~".*-prod"} # 正则匹配
{level!="debug"} # 不等于
Filter expressions
过滤表达式
{job="api-server"} |= "error" # Contains
{job="api-server"} != "debug" # Not contains
{job="api-server"} |~ "err." # Regex match
{job="api-server"} !~ "debug." # Regex not match
undefined{job="api-server"} |= "error" # 包含
{job="api-server"} != "debug" # 不包含
{job="api-server"} |~ "err." # 正则匹配
{job="api-server"} !~ "debug." # 正则不匹配
undefinedPipeline Stages
流水线阶段
logql
undefinedlogql
undefinedJSON parsing
JSON解析
{job="api-server"} | json
{job="api-server"} | json
Extract specific fields
提取特定字段
{job="api-server"} | json | line_format "{{.message}}"
{job="api-server"} | json | line_format "{{.message}}"
Label extraction
标签提取
{job="api-server"} | logfmt | level="error"
{job="api-server"} | logfmt | level="error"
Pattern matching
模式匹配
{job="api-server"} | pattern "<ip> - - [<_>] "<method> <path>"" | method="POST"
undefined{job="api-server"} | pattern "<ip> - - [<_>] "<method> <path>"" | method="POST"
undefinedMetric Queries
指标查询
logql
undefinedlogql
undefinedCount logs per minute
每分钟日志计数
count_over_time({job="api-server"}[1m])
count_over_time({job="api-server"}[1m])
Rate of errors
错误率
rate({job="api-server"} |= "error" [5m])
rate({job="api-server"} |= "error" [5m])
Bytes rate
字节速率
bytes_rate({job="api-server"}[5m])
bytes_rate({job="api-server"}[5m])
Sum by label
按标签求和
sum by (namespace) (rate({job="api-server"}[5m]))
sum by (namespace) (rate({job="api-server"}[5m]))
Top 10 by volume
按体积排序的前10项
topk(10, sum by (namespace) (bytes_rate({}[5m])))
undefinedtopk(10, sum by (namespace) (bytes_rate({}[5m])))
undefinedOpenTelemetry Integration
OpenTelemetry 集成
Native OTLP (Recommended - Loki 3.0+)
原生OTLP(推荐 - Loki 3.0+)
OpenTelemetry Collector Config:
yaml
exporters:
otlphttp:
endpoint: http://loki-gateway:3100/otlp
headers:
X-Scope-OrgID: "my-tenant"
service:
pipelines:
logs:
receivers: [otlp]
exporters: [otlphttp]Loki Config:
yaml
loki:
limits_config:
allow_structured_metadata: true # Required for OTLPKey Benefits:
- Log body stored as plain text (not JSON encoded)
- 17 default resource attributes auto-indexed
- Simpler queries without JSON parsing
- Better storage efficiency
OpenTelemetry Collector 配置:
yaml
exporters:
otlphttp:
endpoint: http://loki-gateway:3100/otlp
headers:
X-Scope-OrgID: "my-tenant"
service:
pipelines:
logs:
receivers: [otlp]
exporters: [otlphttp]Loki 配置:
yaml
loki:
limits_config:
allow_structured_metadata: true # OTLP 所需配置核心优势:
- 日志正文以纯文本存储(而非JSON编码)
- 17个默认资源属性自动索引
- 无需JSON解析即可进行简单查询
- 存储效率更高
Resource Attribute Mapping
资源属性映射
| OTLP Attribute | Loki Label |
|---|---|
| |
| |
| |
| |
| |
| OTLP 属性 | Loki 标签 |
|---|---|
| |
| |
| |
| |
| |
Kubernetes Helm Deployment
Kubernetes Helm 部署
Add Repository
添加仓库
bash
helm repo add grafana https://grafana.github.io/helm-charts
helm repo updatebash
helm repo add grafana https://grafana.github.io/helm-charts
helm repo updateInstall with Values
使用自定义值安装
bash
helm install loki grafana/loki \
--namespace monitoring \
--values values.yamlbash
helm install loki grafana/loki \
--namespace monitoring \
--values values.yamlProduction Values Example
生产环境配置示例
yaml
deploymentMode: Distributed
loki:
auth_enabled: true
schemaConfig:
configs:
- from: "2024-04-01"
store: tsdb
object_store: azure
schema: v13
index:
prefix: loki_index_
period: 24h
storage:
type: azure
azure:
accountName: mystorageaccount
useManagedIdentity: true
userAssignedId: <client-id>
bucketNames:
chunks: loki-chunks
ruler: loki-ruler
admin: loki-admin
limits_config:
retention_period: 2160h # 90 days
allow_structured_metadata: true
ingester:
replicas: 3
zoneAwareReplication:
enabled: true
resources:
requests:
cpu: 2
memory: 8Gi
limits:
cpu: 4
memory: 16Gi
querier:
replicas: 3
maxUnavailable: 2
queryFrontend:
replicas: 2
distributor:
replicas: 3
compactor:
replicas: 1
indexGateway:
replicas: 2
maxUnavailable: 1yaml
deploymentMode: Distributed
loki:
auth_enabled: true
schemaConfig:
configs:
- from: "2024-04-01"
store: tsdb
object_store: azure
schema: v13
index:
prefix: loki_index_
period: 24h
storage:
type: azure
azure:
accountName: mystorageaccount
useManagedIdentity: true
userAssignedId: <client-id>
bucketNames:
chunks: loki-chunks
ruler: loki-ruler
admin: loki-admin
limits_config:
retention_period: 2160h # 90天
allow_structured_metadata: true
ingester:
replicas: 3
zoneAwareReplication:
enabled: true
resources:
requests:
cpu: 2
memory: 8Gi
limits:
cpu: 4
memory: 16Gi
querier:
replicas: 3
maxUnavailable: 2
queryFrontend:
replicas: 2
distributor:
replicas: 3
compactor:
replicas: 1
indexGateway:
replicas: 2
maxUnavailable: 1Gateway for external access
外部访问网关
gateway:
service:
type: LoadBalancer
gateway:
service:
type: LoadBalancer
Monitoring
监控
monitoring:
serviceMonitor:
enabled: true
undefinedmonitoring:
serviceMonitor:
enabled: true
undefinedAzure Identity Configuration
Azure 身份配置
User-Assigned Managed Identity (Recommended)
用户分配的托管标识(推荐)
1. Create Identity:
bash
az identity create \
--name loki-identity \
--resource-group <rg>
IDENTITY_CLIENT_ID=$(az identity show --name loki-identity --resource-group <rg> --query clientId -o tsv)
IDENTITY_PRINCIPAL_ID=$(az identity show --name loki-identity --resource-group <rg> --query principalId -o tsv)2. Assign to Node Pool:
bash
az vmss identity assign \
--resource-group <aks-node-rg> \
--name <vmss-name> \
--identities /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/loki-identity3. Grant Storage Permission:
bash
az role assignment create \
--role "Storage Blob Data Contributor" \
--assignee-object-id $IDENTITY_PRINCIPAL_ID \
--scope /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Storage/storageAccounts/<storage>4. Configure Loki:
yaml
loki:
storage:
azure:
useManagedIdentity: true
userAssignedId: <IDENTITY_CLIENT_ID>1. 创建标识:
bash
az identity create \
--name loki-identity \
--resource-group <rg>
IDENTITY_CLIENT_ID=$(az identity show --name loki-identity --resource-group <rg> --query clientId -o tsv)
IDENTITY_PRINCIPAL_ID=$(az identity show --name loki-identity --resource-group <rg> --query principalId -o tsv)2. 分配给节点池:
bash
az vmss identity assign \
--resource-group <aks-node-rg> \
--name <vmss-name> \
--identities /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/loki-identity3. 授予存储权限:
bash
az role assignment create \
--role "Storage Blob Data Contributor" \
--assignee-object-id $IDENTITY_PRINCIPAL_ID \
--scope /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Storage/storageAccounts/<storage>4. 配置Loki:
yaml
loki:
storage:
azure:
useManagedIdentity: true
userAssignedId: <IDENTITY_CLIENT_ID>Multi-Tenancy
多租户
yaml
loki:
auth_enabled: trueyaml
loki:
auth_enabled: trueQuery with tenant header
携带租户头查询
curl -H "X-Scope-OrgID: tenant-a"
"http://loki:3100/loki/api/v1/query?query={job=\"app\"}"
"http://loki:3100/loki/api/v1/query?query={job=\"app\"}"
curl -H "X-Scope-OrgID: tenant-a"
"http://loki:3100/loki/api/v1/query?query={job=\"app\"}"
"http://loki:3100/loki/api/v1/query?query={job=\"app\"}"
Multi-tenant queries (if enabled)
多租户查询(若启用)
X-Scope-OrgID: tenant-a|tenant-b
X-Scope-OrgID: tenant-a|tenant-b
undefinedundefinedTroubleshooting
故障排除
Common Issues
常见问题
1. Container Not Found (Azure)
bash
undefined1. 容器未找到(Azure)
bash
undefinedCreate required containers
创建所需容器
az storage container create --name loki-chunks --account-name <storage>
az storage container create --name loki-ruler --account-name <storage>
az storage container create --name loki-admin --account-name <storage>
**2. Authorization Failure (Azure)**
```bashaz storage container create --name loki-chunks --account-name <storage>
az storage container create --name loki-ruler --account-name <storage>
az storage container create --name loki-admin --account-name <storage>
**2. 授权失败(Azure)**
```bashVerify RBAC assignment
验证RBAC分配
az role assignment list --scope /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Storage/storageAccounts/<storage>
az role assignment list --scope /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Storage/storageAccounts/<storage>
Assign if missing
若缺失则分配
az role assignment create
--role "Storage Blob Data Contributor"
--assignee-object-id <principal-id>
--scope <storage-scope>
--role "Storage Blob Data Contributor"
--assignee-object-id <principal-id>
--scope <storage-scope>
az role assignment create
--role "Storage Blob Data Contributor"
--assignee-object-id <principal-id>
--scope <storage-scope>
--role "Storage Blob Data Contributor"
--assignee-object-id <principal-id>
--scope <storage-scope>
Restart pod to refresh token
重启Pod刷新令牌
kubectl delete pod -n monitoring <ingester-pod>
**3. Ingester OOM**
```yamlkubectl delete pod -n monitoring <ingester-pod>
**3. Ingester 内存溢出**
```yamlIncrease memory limits
增加内存限制
ingester:
resources:
limits:
memory: 16Gi
**4. Query Timeout**
```yaml
loki:
querier:
query_timeout: 5m
max_concurrent: 8
query_scheduler:
max_outstanding_requests_per_tenant: 2048ingester:
resources:
limits:
memory: 16Gi
**4. 查询超时**
```yaml
loki:
querier:
query_timeout: 5m
max_concurrent: 8
query_scheduler:
max_outstanding_requests_per_tenant: 2048Diagnostic Commands
诊断命令
bash
undefinedbash
undefinedCheck pod status
检查Pod状态
kubectl get pods -n monitoring -l app.kubernetes.io/name=loki
kubectl get pods -n monitoring -l app.kubernetes.io/name=loki
Check ingester logs
查看Ingester日志
kubectl logs -n monitoring -l app.kubernetes.io/component=ingester --tail=100
kubectl logs -n monitoring -l app.kubernetes.io/component=ingester --tail=100
Check compactor logs
查看Compactor日志
kubectl logs -n monitoring -l app.kubernetes.io/component=compactor --tail=100
kubectl logs -n monitoring -l app.kubernetes.io/component=compactor --tail=100
Verify readiness
验证就绪状态
kubectl exec -it <loki-pod> -n monitoring -- wget -qO- http://localhost:3100/ready
kubectl exec -it <loki-pod> -n monitoring -- wget -qO- http://localhost:3100/ready
Check configuration
检查配置
kubectl exec -it <loki-pod> -n monitoring -- cat /etc/loki/config/config.yaml
undefinedkubectl exec -it <loki-pod> -n monitoring -- cat /etc/loki/config/config.yaml
undefinedAPI Reference
API 参考
Ingestion
写入
bash
undefinedbash
undefinedPush logs
推送日志
POST /loki/api/v1/push
POST /loki/api/v1/push
OTLP logs
OTLP 日志
POST /otlp/v1/logs
undefinedPOST /otlp/v1/logs
undefinedQuery
查询
bash
undefinedbash
undefinedInstant query
即时查询
GET /loki/api/v1/query?query={job="app"}&time=<timestamp>
GET /loki/api/v1/query?query={job="app"}&time=<timestamp>
Range query
范围查询
GET /loki/api/v1/query_range?query={job="app"}&start=<start>&end=<end>
GET /loki/api/v1/query_range?query={job="app"}&start=<start>&end=<end>
Labels
标签
GET /loki/api/v1/labels
GET /loki/api/v1/label/<name>/values
GET /loki/api/v1/labels
GET /loki/api/v1/label/<name>/values
Series
序列
GET /loki/api/v1/series
GET /loki/api/v1/series
Tail (WebSocket)
实时尾部(WebSocket)
GET /loki/api/v1/tail?query={job="app"}
undefinedGET /loki/api/v1/tail?query={job="app"}
undefinedHealth
健康检查
bash
GET /ready
GET /metricsbash
GET /ready
GET /metricsReference Documentation
参考文档
For detailed configuration by topic:
- Storage Configuration: Object stores, retention, WAL
- LogQL Reference: Query syntax and examples
- OpenTelemetry Integration: OTLP configuration
按主题分类的详细配置文档:
- 存储配置: 对象存储、日志保留、WAL
- LogQL 参考: 查询语法与示例
- OpenTelemetry 集成: OTLP 配置