当前位置: 首页 > wzjs >正文

家具东莞网站建设0769官方设计方案

家具东莞网站建设0769,官方设计方案,天长网站开发,wordpress淘宝客单页模板下载本地安装 Grafana Loki 一、 安装 Loki1. 下载 Loki2. 创建 Loki 配置文件3. 创建 Loki 服务 二、安装 Promtail1. 下载 Promtail2. 创建 Promtail 配置文件3. 创建 Promtail 服务 三、 安装 Grafana四、启动所有服务五、添加loki 数据源1. 添加仪表板2. 日志查询面板 json 参考…

本地安装 Grafana Loki

  • 一、 安装 Loki
    • 1. 下载 Loki
    • 2. 创建 Loki 配置文件
    • 3. 创建 Loki 服务
  • 二、安装 Promtail
    • 1. 下载 Promtail
    • 2. 创建 Promtail 配置文件
    • 3. 创建 Promtail 服务
  • 三、 安装 Grafana
  • 四、启动所有服务
  • 五、添加loki 数据源
    • 1. 添加仪表板
    • 2. 日志查询面板 json
  • 参考

一、 安装 Loki

1. 下载 Loki

# 下载 Loki
wget https://github.com/grafana/loki/releases/download/v3.4.2/loki-linux-amd64.zip
unzip loki-linux-amd64.zip# 移动到合适的位置
sudo mv loki-linux-amd64 /usr/local/bin/loki# 创建配置目录
sudo mkdir -p /etc/loki

2. 创建 Loki 配置文件

# 创建必要的目录
sudo mkdir -p /var/lib/loki/chunks
sudo mkdir -p /var/lib/loki/rules
sudo mkdir -p /var/lib/loki/index
sudo mkdir -p /var/lib/loki/cache 
vim /etc/loki/config.yaml
auth_enabled: falseserver:http_listen_port: 3100common:path_prefix: /lokistorage:filesystem:chunks_directory: /var/lib/loki/chunksrules_directory: /var/lib/loki/rulesreplication_factor: 1ring:instance_addr: 127.0.0.1kvstore:store: inmemoryschema_config:configs:- from: 2020-10-24store: tsdbobject_store: filesystemschema: v13index:prefix: index_period: 24hstorage_config:tsdb_shipper:active_index_directory: /var/lib/loki/indexcache_location: /var/lib/loki/cacheruler:alertmanager_url: http://localhost:9093
# 是否启用认证
auth_enabled: false# 服务器配置
server:http_listen_port: 3100  # Loki API 监听端口# 通用配置
common:path_prefix: /loki    # API 路径前缀storage:filesystem:         # 使用本地文件系统存储chunks_directory: /var/lib/loki/chunks  # 日志数据块存储目录rules_directory: /var/lib/loki/rules    # 告警规则存储目录replication_factor: 1   # 复制因子,1表示单实例ring:instance_addr: 127.0.0.1  # 实例地址kvstore:store: inmemory        # 使用内存存储作为键值存储# schema 配置,定义如何存储和索引数据
schema_config:configs:- from: 2020-10-24      # 配置生效时间store: tsdb           # 使用 TSDB 存储引擎object_store: filesystem  # 使用文件系统作为对象存储schema: v13              # 使用 v13 版本的 schemaindex:prefix: index_         # 索引文件前缀period: 24h           # 索引周期,每24小时创建新的索引# 存储配置
storage_config:tsdb_shipper:active_index_directory: /var/lib/loki/index  # 活跃索引目录cache_location: /var/lib/loki/cache          # 缓存位置# 规则配置
ruler:alertmanager_url: http://localhost:9093  # Alertmanager 地址

3. 创建 Loki 服务

sudo tee /etc/systemd/system/loki.service<<EOF
[Unit]
Description=Loki service
After=network.target[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/loki -config.file /etc/loki/config.yaml[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl restart loki.service
systemctl status loki.servicesystemctl enable loki.service

二、安装 Promtail

1. 下载 Promtail

# 下载 Promtail
wget https://github.com/grafana/loki/releases/download/v3.4.2/promtail-linux-amd64.zip
unzip promtail-linux-amd64.zip# 移动到合适的位置
sudo mv promtail-linux-amd64 /usr/local/bin/promtail# 创建配置目录
sudo mkdir -p /etc/promtail

2. 创建 Promtail 配置文件

vim /etc/promtail/config.yaml
server:http_listen_port: 9080grpc_listen_port: 0positions:filename: /tmp/positions.yamlclients:- url: http://localhost:3100/loki/api/v1/pushscrape_configs:- job_name: systemstatic_configs:- targets:- localhostlabels:job: varlogs__path__: /var/log/*log- job_name: dockerstatic_configs:- targets:- localhostlabels:job: docker__path__: /var/lib/docker/containers/*/*log

3. 创建 Promtail 服务

sudo tee /etc/systemd/system/promtail.service<<EOF
[Unit]
Description=Promtail service
After=network.target[Service]	
Type=simple
User=root
ExecStart=/usr/local/bin/promtail -config.file /etc/promtail/config.yaml[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start promtail.service
systemctl status promtail.servicesystemctl enable promtail.service

三、 安装 Grafana

四、启动所有服务

# 创建必要的目录
sudo mkdir -p /var/lib/loki/chunks
sudo mkdir -p /var/lib/loki/rules# 启动服务
sudo systemctl daemon-reload
sudo systemctl enable loki promtail grafana-server
sudo systemctl start loki promtail grafana-server# 检查服务状态
sudo systemctl status loki
sudo systemctl status promtail
sudo systemctl status grafana-server

五、添加loki 数据源

在这里插入图片描述

1. 添加仪表板

17514
https://grafana.com/grafana/dashboards/17514-ssh-logs/

在这里插入图片描述

2. 日志查询面板 json

{"annotations": {"list": [{"builtIn": 1,"datasource": {"type": "grafana","uid": "-- Grafana --"},"enable": true,"hide": true,"iconColor": "rgba(0, 211, 255, 1)","name": "Annotations & Alerts","type": "dashboard"}]},"editable": true,"fiscalYearStartMonth": 0,"graphTooltip": 0,"id": 13,"links": [],"liveNow": false,"panels": [{"datasource": {"type": "loki","uid": "cedpi2os8xbeoa"},"gridPos": {"h": 20,"w": 24,"x": 0,"y": 0},"id": 1,"options": {"dedupStrategy": "none","enableLogDetails": true,"prettifyLogMessage": false,"showCommonLabels": false,"showLabels": false,"showTime": true,"sortOrder": "Descending","wrapLogMessage": true},"targets": [{"datasource": {"type": "loki","uid": "cedpi2os8xbeoa"},"editorMode": "builder","expr": "{filename=~\"$log_file\"} |= \"$search_term\"","queryType": "range","refId": "A"}],"title": "日志查询面板","type": "logs"}],"refresh": "1m","schemaVersion": 39,"tags": ["logs","monitoring"],"templating": {"list": [{"current": {"selected": false,"text": "All","value": "$__all"},"datasource": {"type": "loki","uid": "cedpi2os8xbeoa"},"definition": "label_values(filename)","hide": 0,"includeAll": true,"label": "日志文件","multi": false,"name": "log_file","options": [],"query": "label_values(filename)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 1,"type": "query"},{"current": {"selected": false,"text": "","value": ""},"hide": 0,"label": "搜索关键字","name": "search_term","options": [],"query": "","skipUrlSync": false,"type": "textbox"}]},"time": {"from": "now-1h","to": "now"},"timepicker": {"refresh_intervals": ["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"]},"timezone": "","title": "日志查询仪表板","uid": "log_dashboard","version": 3,"weekStart": ""
}

在这里插入图片描述

参考

  1. 本地安装 Grafana Loki
  2. loki releases
  3. SSH Logs
http://www.dtcms.com/wzjs/560564.html

相关文章:

  • 包头学做网站南京网络推广建站
  • 邢台网站建设网站wordpress伪静态插件
  • 网站建设开发技术天津简单个人网页模板
  • 滨江做网站英雄传奇手机版网页版
  • 在灵璧怎样做网站网站平台免费
  • 惠州网站建设技术支持微营销推广软件
  • 郑州做网站九零后网络wordpress编辑分类
  • 推广网官方推广网站做的比较炫的网站
  • 廖雪峰的网站怎么做的莱芜金点子招聘网
  • 高端网站制作技术wordpress 调用缩略图
  • 国外专业做集装箱别墅网站南宁网站建设哪家好
  • 英文手机商城网站建设没有网站怎么做淘客
  • 马鞍山做网站的公司78建设厅网站上怎么实名认证
  • vue 直播网站开发天河做网站哪家好
  • 上海网站制作开发上海市建设工程监理咨询有限公司
  • 网站如何带来流量学室内设计要学什么软件
  • 新闻类网站开发重庆宣传片
  • 网站后台怎么进入wordpress石家庄专门做网站的公司
  • 免费招聘网站有哪些平台inove wordpress
  • 乡镇门户网站建设的现状及发展对策网站设计标杆企业
  • 跟建设通差不多额网站网站图片设置方法
  • 网站设计方案口碑好的番禺网站建设
  • 西安网站seo公司网站建设 毕业设计
  • 邢台做移动网站多少钱网站建设后期收什么费用
  • 英茗网站建设排名第一的玉米品种
  • 毕设做网站有什么题目哈尔滨招标信息网官网
  • 最有效的网站推广费用做饮食找工作哪个网站好
  • 用wix做网站需要备案吗怎么制作属于自己的app
  • wordpress的编码问题安徽网站优化哪里有
  • 濮阳市建设局网站免费商城系统哪个好