Loki 收集日志
组件
- loki 服务端
- promtail 收集器Agent
- grafana 展示
部署
Loki
[root@localhost ~]# cat loki-local-config.yaml
auth_enabled: false
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 192.168.81.129
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
max_transfer_retries: 0
schema_config:
configs:
- from: 2018-04-15
store: boltdb
object_store: filesystem
schema: v11
index:
prefix: index_
period: 168h
storage_config:
boltdb:
directory: /tmp/loki/index
filesystem:
directory: /tmp/loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0s
table_manager:
retention_deletes_enabled: false
retention_period: 0s
promtail
[root@localhost ~]# cat promtail-config.yaml
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://192.168.81.129:3100/loki/api/v1/push
scrape_configs:
- job_name: system
static_configs:
- targets:
- 192.168.81.129
labels:
job: varlogs
__path__: /var/log/*log
- job_name: message
static_configs:
- targets:
- 192.168.81.129
labels:
job: msglogs
__path__: /var/log/messages
- job_name: nginx
static_configs:
- targets:
- 192.168.81.129
labels:
job: nginxlogs
__path__: /usr/local/docker/nginx/logs/*log
grafana