轻量日志系统Loki安装

轻量级日志系统Loki安装

组成:

  • promtail是代理,负责收集日志并将其发送给Loki。
  • loki是主服务器,负责存储日志和处理查询。
  • Grafana用于查询和显示日志。

安装

一、loki和promtail
curl -O -L "https://github.com/grafana/loki/releases/download/v1.5.0/loki-linux-amd64.zip"
unzip loki-linux-amd64.zip
chmod a+x loki-linux-amd64

curl -O -l "https://github.com/grafana/loki/releases/download/v1.5.0/promtail-linux-amd64.zip"
unzip promtail-linux-amd64.zip
chmod a+x promtail-linux-amd64

二、Grafana

Grafana官网下载地址:Grafana

#下载
wget https://dl.grafana.com/oss/release/grafana-6.3.2-1.x86_64.rpm

#安装依赖
yum install initscripts fontconfig  
yum install freetype
yum install urw-fonts

#安装
rpm -ivh grafana-6.3.2-1.x86_64.rpm

三、添加loki的配置文件 loki.yml
auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 5m
  chunk_retain_period: 30s

schema_config:
  configs:
    - from: 2020-07-09
      store: boltdb
      object_store: filesystem
      schema: v9
      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: 0

#table_manager:
#  chunk_tables_provisioning:
#    inactive_read_throughput: 0
#    inactive_write_throughput: 0
#    provisioned_read_throughput: 0
#    provisioned_write_throughput: 0
#  index_tables_provisioning:
#    inactive_read_throughput: 0
#    inactive_write_throughput: 0
#    provisioned_read_throughput: 0
#    provisioned_write_throughput: 0
#  retention_deletes_enabled: false
#  retention_period: 0

四、添加promtail的配置文件 promtail.yml
# Promtail Server Config
server:
  http_listen_port: 9080
  grpc_listen_port: 0

# 指明promtail的配置文件在什么地方生成
positions:
  filename: /tmp/positions.yaml

# Loki服务器的地址
clients:
  - url: http://127.0.0.1:3100/loki/api/v1/push

scrape_configs:
  - job_name: nginx
    static_configs:
      - targets:
          - localhost
        labels:
          job: nginx-error
          host: localhost
          __path__: /usr/local/nginx/logs/error.log

启动
systemctl start grafana-server.service

./loki-linux-amd64 -config.file=/home/zoehuawang/loki/loki.yml

./promtail-linux-amd64 -config.file=/home/zoehuawang/loki/promtail.yml

本文转载于:https://blog.csdn.net/qq_40236138/article/details/107230640

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值