zoukankan      html  css  js  c++  java
  • 【日志收集】之Loki

    Loki 收集日志

    组件

    1. loki 服务端
    2. promtail 收集器Agent
    3. 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

    • 接入数据源 loki
    • explore
  • 相关阅读:
    UI5 Databind
    the meaning of myconputer environment path
    Linux查看日志常用命令
    fw: IP bonding in Linux.
    FW:expect tcl install
    install ET underlinux
    转expect 文一篇。
    linux 集萃
    try expect and autoexpect
    linux 压缩种类
  • 原文地址:https://www.cnblogs.com/gooooodmorning/p/13492784.html
Copyright © 2011-2022 走看看