zoukankan      html  css  js  c++  java
  • Loki 部署使用

    Loki安装使用

    安装 loki

    四种安装方式

    https://github.com/grafana/loki/blob/v1.5.0/docs/installation/README.md
    

    我选择 Installing Loki with Docker or Docker Compose

    docker-compose.yml

    version: "3"
    
    services:
      loki:
        image: grafana/loki:1.5.0
        restart: always
        ports:
          - "3100:3100"
        command: -config.file=/etc/loki/local-config.yaml
        volumes:
          - loki-config:/etc/loki
        networks:
          - loki
    
      promtail:
        image: grafana/promtail:1.5.0
        restart: always
        volumes:
        # promtail 采集日志的目录(宿主机的目录)  /root/log 也可以直接采集容器目录
          - /root/logs:/var/log
          - promtail-config:/etc/promtail
        command: -config.file=/etc/promtail/docker-config.yaml
        networks:
          - loki
    
      grafana:
        image: grafana/grafana
        restart: always
        ports:
          - "3000:3000"
        depends_on:
          - loki
          - promtail
        volumes:
          - grafana-storage:/var/lib/grafana
        networks:
          - loki
    
    networks:
      loki:
    
    volumes:
      loki-config:
      promtail-config:
      grafana-storage:
    

    启动

    docker-compose up -d

    访问

    http://ip:3000/
    

    登录密码admin/admin
    点击侧边栏,添加数据源

    点击explore

    选择日志数据源

    下方获取到收集的日志。可以按照级别分类

    假如我想过滤简单的日志查询
    {filename="/var/log/boot.log"} |= "application"
    查询文件中application 出现的地方

    点击右边 查看出现的上下文章信息

    Loki日志部署到采集完成。

    以上{filename="/var/log/boot.log"} |= "application" 只是简单的查询语法。
    PromQL 提供了复杂的查询功能。可是配合数据产出报表

  • 相关阅读:
    ubuntu video and audio
    js type
    jumpserver 堡垒机环境搭建
    ubuntu dnsmasq
    bind--dns-docker---[nslookup/dig]
    java maven scope compile,provide,system,test,runtime
    docker install and minikube install
    nginx break-circus orange api-gateway
    一个IP能建立的最大连接数是多少?
    Docker 在6.4上安装
  • 原文地址:https://www.cnblogs.com/munan56/p/13498989.html
Copyright © 2011-2022 走看看