Promtail:修订间差异

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
第11行: 第11行:
== 設定 ==
== 設定 ==


 先建立:
 先建立 狀態目錄


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
第17行: 第17行:
</syntaxhighlight>
</syntaxhighlight>


 在<code>/etc/promtail/config.yml</code>裡面 把positions.yaml的 檔案放到<code>/var/lib/promtail</code>下:
 在<code>/etc/promtail/config.yml</code>裡面 把狀態 檔案放到<code>/var/lib/promtail</code>下:


<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">

2023年6月28日 (三) 07:19的版本

Promtail是Log传输软体,属于GrafanaLoki生态系。

安装

Ubuntu上可以透过官方的APT repository安装:

sudo curl -L -o /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key; echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list; sudo apt update; sudo apt install -y promtail; sudo apt clean

设定

先建立状态目录:

sudo mkdir /var/lib/promtail; sudo chown promtail:nogroup /var/lib/promtail

/etc/promtail/config.yml里面把状态档案放到/var/lib/promtail下:

positions:
  filename: /var/lib/promtail/positions.yaml

另外把Loki预设的位置改成实际的位置:

clients:
  - url: http://loki.example.com:3100/loki/api/v1/push

然后重新启动:

sudo service promtail restart

相关连结

外部连结