Skip to content

Commit 5aafffe

Browse files
Milvus-doc-botMilvus-doc-bot
authored andcommitted
Generate en docs
1 parent a1b1fa6 commit 5aafffe

File tree

2 files changed

+87
-11
lines changed

2 files changed

+87
-11
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"codeList":["helm repo add grafana https://grafana.github.io/helm-charts\nhelm repo update\n","loki:\n commonConfig:\n replication_factor: 1\n auth_enabled: false\n\nminio:\n enabled: true\n","loki:\n commonConfig:\n replication_factor: 1\n auth_enabled: false\n storage:\n bucketNames:\n chunks: loki-chunks\n ruler: loki-ruler\n admin: loki-admin\n type: 's3'\n s3:\n endpoint: s3.us-west-2.amazonaws.com\n region: us-west-2\n secretAccessKey: <accessKey>\n accessKeyId: <keyId>\n","kubectl create ns loki\nhelm install --values loki.yaml loki grafana/loki -n loki\n","config:\n clients:\n - url: http://loki-gateway/loki/api/v1/push\n","helm install --values promtail.yaml promtail grafana/promtail -n loki\n","kubectl create ns monitoring\nhelm install my-grafana grafana/grafana --namespace monitoring\n","kubectl get secret --namespace monitoring my-grafana -o jsonpath=\"{.data.admin-password}\" | base64 --decode ; echo\n","export POD_NAME=$(kubectl get pods --namespace monitoring -l \"app.kubernetes.io/name=grafana,app.kubernetes.io/instance=my-grafana\" -o jsonpath=\"{.items[0].metadata.name}\")\nkubectl --namespace monitoring port-forward $POD_NAME 3000\n"],"headingContent":"Configure Grafana Loki","anchorList":[{"label":"Configure Grafana Loki","href":"Configure-Grafana-Loki","type":1,"isActive":false},{"label":"Prerequisites","href":"Prerequisites","type":2,"isActive":false},{"label":"Deploy Loki","href":"Deploy-Loki","type":2,"isActive":false},{"label":"1. Add Grafana's Helm Chart Repository","href":"1-Add-Grafanas-Helm-Chart-Repository","type":3,"isActive":false},{"label":"2. Configure Object Storage for Loki","href":"2-Configure-Object-Storage-for-Loki","type":3,"isActive":false},{"label":"3. Install Loki","href":"3-Install-Loki","type":3,"isActive":false},{"label":"Deploy Promtail","href":"Deploy-Promtail","type":2,"isActive":false},{"label":"1. Create Promtail Configuration","href":"1-Create-Promtail-Configuration","type":3,"isActive":false},{"label":"2. Install Promtail","href":"2-Install-Promtail","type":3,"isActive":false},{"label":"Query Logs with Grafana","href":"Query-Logs-with-Grafana","type":2,"isActive":false},{"label":"1. Deploy Grafana","href":"1-Deploy-Grafana","type":3,"isActive":false},{"label":"2. Add Loki as a Data Source in Grafana","href":"2-Add-Loki-as-a-Data-Source-in-Grafana","type":3,"isActive":false},{"label":"3. Query Milvus Logs","href":"3-Query-Milvus-Logs","type":3,"isActive":false}]}
1+
{"codeList":["helm repo add grafana https://grafana.github.io/helm-charts\nhelm repo update\n","loki:\n commonConfig:\n replication_factor: 1\n auth_enabled: false\n\nminio:\n enabled: true\n","loki:\n commonConfig:\n replication_factor: 1\n auth_enabled: false\n storage:\n bucketNames:\n chunks: loki-chunks\n ruler: loki-ruler\n admin: loki-admin\n type: 's3'\n s3:\n endpoint: s3.us-west-2.amazonaws.com\n region: us-west-2\n secretAccessKey: <accessKey>\n accessKeyId: <keyId>\n","kubectl create ns loki\nhelm install --values loki.yaml loki grafana/loki -n loki\n","alloy:\n enableReporting: false\n resources: {}\n configMap:\n create: true\n content: |-\n loki.write \"default\" {\n endpoint {\n url = \"http://loki-gateway/loki/api/v1/push\"\n }\n }\n\n discovery.kubernetes \"pod\" {\n role = \"pod\"\n }\n\n loki.source.kubernetes \"pod_logs\" {\n targets = discovery.relabel.pod_logs.output\n forward_to = [loki.write.default.receiver]\n }\n\n // Rewrite the label set to make log query easier\n discovery.relabel \"pod_logs\" {\n targets = discovery.kubernetes.pod.targets\n rule {\n source_labels = [\"__meta_kubernetes_namespace\"]\n action = \"replace\"\n target_label = \"namespace\"\n }\n\n // \"pod\" <- \"__meta_kubernetes_pod_name\"\n rule {\n source_labels = [\"__meta_kubernetes_pod_name\"]\n action = \"replace\"\n target_label = \"pod\"\n }\n\n // \"container\" <- \"__meta_kubernetes_pod_container_name\"\n rule {\n source_labels = [\"__meta_kubernetes_pod_container_name\"]\n action = \"replace\"\n target_label = \"container\"\n }\n\n // \"app\" <- \"__meta_kubernetes_pod_label_app_kubernetes_io_name\"\n rule {\n source_labels = [\"__meta_kubernetes_pod_label_app_kubernetes_io_name\"]\n action = \"replace\"\n target_label = \"app\"\n }\n\n // \"job\" <- \"__meta_kubernetes_namespace\", \"__meta_kubernetes_pod_container_name\"\n rule {\n source_labels = [\"__meta_kubernetes_namespace\", \"__meta_kubernetes_pod_container_name\"]\n action = \"replace\"\n target_label = \"job\"\n separator = \"/\"\n replacement = \"$1\"\n }\n\n // L\"__path__\" <- \"__meta_kubernetes_pod_uid\", \"__meta_kubernetes_pod_container_name\"\n rule {\n source_labels = [\"__meta_kubernetes_pod_uid\", \"__meta_kubernetes_pod_container_name\"]\n action = \"replace\"\n target_label = \"__path__\"\n separator = \"/\"\n replacement = \"/var/log/pods/*$1/*.log\"\n }\n\n // \"container_runtime\" <- \"__meta_kubernetes_pod_container_id\"\n rule {\n source_labels = [\"__meta_kubernetes_pod_container_id\"]\n action = \"replace\"\n target_label = \"container_runtime\"\n regex = \"^(\\\\S+):\\\\/\\\\/.+$\"\n replacement = \"$1\"\n }\n }\n","helm install --values promtail.yaml promtail grafana/promtail -n loki\n","kubectl create ns monitoring\nhelm install my-grafana grafana/grafana --namespace monitoring\n","kubectl get secret --namespace monitoring my-grafana -o jsonpath=\"{.data.admin-password}\" | base64 --decode ; echo\n","export POD_NAME=$(kubectl get pods --namespace monitoring -l \"app.kubernetes.io/name=grafana,app.kubernetes.io/instance=my-grafana\" -o jsonpath=\"{.items[0].metadata.name}\")\nkubectl --namespace monitoring port-forward $POD_NAME 3000\n"],"headingContent":"Configure Grafana Loki","anchorList":[{"label":"Configure Grafana Loki","href":"Configure-Grafana-Loki","type":1,"isActive":false},{"label":"Prerequisites","href":"Prerequisites","type":2,"isActive":false},{"label":"Deploy Loki","href":"Deploy-Loki","type":2,"isActive":false},{"label":"1. Add Grafana's Helm Chart Repository","href":"1-Add-Grafanas-Helm-Chart-Repository","type":3,"isActive":false},{"label":"2. Configure Object Storage for Loki","href":"2-Configure-Object-Storage-for-Loki","type":3,"isActive":false},{"label":"3. Install Loki","href":"3-Install-Loki","type":3,"isActive":false},{"label":"Deploy Alloy","href":"Deploy-Alloy","type":2,"isActive":false},{"label":"1. Create Alloy Configuration","href":"1-Create-Alloy-Configuration","type":3,"isActive":false},{"label":"2. Install Alloy","href":"2-Install-Alloy","type":3,"isActive":false},{"label":"Query Logs with Grafana","href":"Query-Logs-with-Grafana","type":2,"isActive":false},{"label":"1. Deploy Grafana","href":"1-Deploy-Grafana","type":3,"isActive":false},{"label":"2. Add Loki as a Data Source in Grafana","href":"2-Add-Loki-as-a-Data-Source-in-Grafana","type":3,"isActive":false},{"label":"3. Query Milvus Logs","href":"3-Query-Milvus-Logs","type":3,"isActive":false}]}

localization/v2.5.x/site/en/adminGuide/monitor/configure_grafana_loki.md

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ summary: >-
2727
<li>Configure object storage for Loki.</li>
2828
<li>Query logs using Grafana.</li>
2929
</ul>
30+
<p>For reference, <a href="https://grafana.com/docs/loki/latest/send-data/promtail/#promtail-agent">Promtail</a> will be deprecated.
31+
So we introduce Alloy, which has been officially suggested by Grafana Labs as the new agent to collect Kubernetes logs and forward them to Loki.</p>
3032
<h2 id="Prerequisites" class="common-anchor-header">Prerequisites<button data-href="#Prerequisites" class="anchor-icon" translate="no">
3133
<svg translate="no"
3234
aria-hidden="true"
@@ -145,7 +147,7 @@ helm repo update
145147
<pre><code translate="no" class="language-shell">kubectl create ns loki
146148
helm install --values loki.yaml loki grafana/loki -n loki
147149
<button class="copy-code-btn"></button></code></pre>
148-
<h2 id="Deploy-Promtail" class="common-anchor-header">Deploy Promtail<button data-href="#Deploy-Promtail" class="anchor-icon" translate="no">
150+
<h2 id="Deploy-Alloy" class="common-anchor-header">Deploy Alloy<button data-href="#Deploy-Alloy" class="anchor-icon" translate="no">
149151
<svg translate="no"
150152
aria-hidden="true"
151153
focusable="false"
@@ -160,8 +162,8 @@ helm install --values loki.yaml loki grafana/loki -n loki
160162
d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"
161163
></path>
162164
</svg>
163-
</button></h2><p>Promtail is a log collection agent for Loki. It reads logs from Milvus pods and sends them to Loki.</p>
164-
<h3 id="1-Create-Promtail-Configuration" class="common-anchor-header">1. Create Promtail Configuration<button data-href="#1-Create-Promtail-Configuration" class="anchor-icon" translate="no">
165+
</button></h2><p>We will show you Alloy <a href="https://grafana.com/docs/alloy/latest/configure/">Configuration</a>.</p>
166+
<h3 id="1-Create-Alloy-Configuration" class="common-anchor-header">1. Create Alloy Configuration<button data-href="#1-Create-Alloy-Configuration" class="anchor-icon" translate="no">
165167
<svg translate="no"
166168
aria-hidden="true"
167169
focusable="false"
@@ -176,12 +178,87 @@ helm install --values loki.yaml loki grafana/loki -n loki
176178
d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"
177179
></path>
178180
</svg>
179-
</button></h3><p>Create a <code translate="no">promtail.yaml</code> configuration file:</p>
180-
<pre><code translate="no" class="language-yaml"><span class="hljs-attr">config:</span>
181-
<span class="hljs-attr">clients:</span>
182-
<span class="hljs-bullet">-</span> <span class="hljs-attr">url:</span> <span class="hljs-string">http://loki-gateway/loki/api/v1/push</span>
181+
</button></h3><p>We will use the following <code translate="no">alloy.yaml</code> to collect logs of all Kubernetes pods & send them to Loki via loki-gateway:</p>
182+
<pre><code translate="no" class="language-yaml"><span class="hljs-attr">alloy:</span>
183+
<span class="hljs-attr">enableReporting:</span> <span class="hljs-literal">false</span>
184+
<span class="hljs-attr">resources:</span> {}
185+
<span class="hljs-attr">configMap:</span>
186+
<span class="hljs-attr">create:</span> <span class="hljs-literal">true</span>
187+
<span class="hljs-attr">content:</span> <span class="hljs-string">|-
188+
loki.write &quot;default&quot; {
189+
endpoint {
190+
url = &quot;http://loki-gateway/loki/api/v1/push&quot;
191+
}
192+
}
193+
</span>
194+
<span class="hljs-string">discovery.kubernetes</span> <span class="hljs-string">&quot;pod&quot;</span> {
195+
<span class="hljs-string">role</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;pod&quot;</span>
196+
}
197+
198+
<span class="hljs-string">loki.source.kubernetes</span> <span class="hljs-string">&quot;pod_logs&quot;</span> {
199+
<span class="hljs-string">targets</span> <span class="hljs-string">=</span> <span class="hljs-string">discovery.relabel.pod_logs.output</span>
200+
<span class="hljs-string">forward_to</span> <span class="hljs-string">=</span> [<span class="hljs-string">loki.write.default.receiver</span>]
201+
}
202+
203+
<span class="hljs-string">//</span> <span class="hljs-string">Rewrite</span> <span class="hljs-string">the</span> <span class="hljs-string">label</span> <span class="hljs-string">set</span> <span class="hljs-string">to</span> <span class="hljs-string">make</span> <span class="hljs-string">log</span> <span class="hljs-string">query</span> <span class="hljs-string">easier</span>
204+
<span class="hljs-string">discovery.relabel</span> <span class="hljs-string">&quot;pod_logs&quot;</span> {
205+
<span class="hljs-string">targets</span> <span class="hljs-string">=</span> <span class="hljs-string">discovery.kubernetes.pod.targets</span>
206+
<span class="hljs-string">rule</span> {
207+
<span class="hljs-string">source_labels</span> <span class="hljs-string">=</span> [<span class="hljs-string">&quot;__meta_kubernetes_namespace&quot;</span>]
208+
<span class="hljs-string">action</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;replace&quot;</span>
209+
<span class="hljs-string">target_label</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;namespace&quot;</span>
210+
}
211+
212+
<span class="hljs-string">//</span> <span class="hljs-string">&quot;pod&quot;</span> <span class="hljs-string">&lt;-</span> <span class="hljs-string">&quot;__meta_kubernetes_pod_name&quot;</span>
213+
<span class="hljs-string">rule</span> {
214+
<span class="hljs-string">source_labels</span> <span class="hljs-string">=</span> [<span class="hljs-string">&quot;__meta_kubernetes_pod_name&quot;</span>]
215+
<span class="hljs-string">action</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;replace&quot;</span>
216+
<span class="hljs-string">target_label</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;pod&quot;</span>
217+
}
218+
219+
<span class="hljs-string">//</span> <span class="hljs-string">&quot;container&quot;</span> <span class="hljs-string">&lt;-</span> <span class="hljs-string">&quot;__meta_kubernetes_pod_container_name&quot;</span>
220+
<span class="hljs-string">rule</span> {
221+
<span class="hljs-string">source_labels</span> <span class="hljs-string">=</span> [<span class="hljs-string">&quot;__meta_kubernetes_pod_container_name&quot;</span>]
222+
<span class="hljs-string">action</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;replace&quot;</span>
223+
<span class="hljs-string">target_label</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;container&quot;</span>
224+
}
225+
226+
<span class="hljs-string">//</span> <span class="hljs-string">&quot;app&quot;</span> <span class="hljs-string">&lt;-</span> <span class="hljs-string">&quot;__meta_kubernetes_pod_label_app_kubernetes_io_name&quot;</span>
227+
<span class="hljs-string">rule</span> {
228+
<span class="hljs-string">source_labels</span> <span class="hljs-string">=</span> [<span class="hljs-string">&quot;__meta_kubernetes_pod_label_app_kubernetes_io_name&quot;</span>]
229+
<span class="hljs-string">action</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;replace&quot;</span>
230+
<span class="hljs-string">target_label</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;app&quot;</span>
231+
}
232+
233+
<span class="hljs-string">//</span> <span class="hljs-string">&quot;job&quot;</span> <span class="hljs-string">&lt;-</span> <span class="hljs-string">&quot;__meta_kubernetes_namespace&quot;</span>, <span class="hljs-string">&quot;__meta_kubernetes_pod_container_name&quot;</span>
234+
<span class="hljs-string">rule</span> {
235+
<span class="hljs-string">source_labels</span> <span class="hljs-string">=</span> [<span class="hljs-string">&quot;__meta_kubernetes_namespace&quot;</span>, <span class="hljs-string">&quot;__meta_kubernetes_pod_container_name&quot;</span>]
236+
<span class="hljs-string">action</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;replace&quot;</span>
237+
<span class="hljs-string">target_label</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;job&quot;</span>
238+
<span class="hljs-string">separator</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;/&quot;</span>
239+
<span class="hljs-string">replacement</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;$1&quot;</span>
240+
}
241+
242+
<span class="hljs-string">//</span> <span class="hljs-string">L&quot;__path__&quot;</span> <span class="hljs-string">&lt;-</span> <span class="hljs-string">&quot;__meta_kubernetes_pod_uid&quot;</span>, <span class="hljs-string">&quot;__meta_kubernetes_pod_container_name&quot;</span>
243+
<span class="hljs-string">rule</span> {
244+
<span class="hljs-string">source_labels</span> <span class="hljs-string">=</span> [<span class="hljs-string">&quot;__meta_kubernetes_pod_uid&quot;</span>, <span class="hljs-string">&quot;__meta_kubernetes_pod_container_name&quot;</span>]
245+
<span class="hljs-string">action</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;replace&quot;</span>
246+
<span class="hljs-string">target_label</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;__path__&quot;</span>
247+
<span class="hljs-string">separator</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;/&quot;</span>
248+
<span class="hljs-string">replacement</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;/var/log/pods/*$1/*.log&quot;</span>
249+
}
250+
251+
<span class="hljs-string">//</span> <span class="hljs-string">&quot;container_runtime&quot;</span> <span class="hljs-string">&lt;-</span> <span class="hljs-string">&quot;__meta_kubernetes_pod_container_id&quot;</span>
252+
<span class="hljs-string">rule</span> {
253+
<span class="hljs-string">source_labels</span> <span class="hljs-string">=</span> [<span class="hljs-string">&quot;__meta_kubernetes_pod_container_id&quot;</span>]
254+
<span class="hljs-string">action</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;replace&quot;</span>
255+
<span class="hljs-string">target_label</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;container_runtime&quot;</span>
256+
<span class="hljs-string">regex</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;^(\\S+):\\/\\/.+$&quot;</span>
257+
<span class="hljs-string">replacement</span> <span class="hljs-string">=</span> <span class="hljs-string">&quot;$1&quot;</span>
258+
}
259+
}
183260
<button class="copy-code-btn"></button></code></pre>
184-
<h3 id="2-Install-Promtail" class="common-anchor-header">2. Install Promtail<button data-href="#2-Install-Promtail" class="anchor-icon" translate="no">
261+
<h3 id="2-Install-Alloy" class="common-anchor-header">2. Install Alloy<button data-href="#2-Install-Alloy" class="anchor-icon" translate="no">
185262
<svg translate="no"
186263
aria-hidden="true"
187264
focusable="false"
@@ -196,8 +273,7 @@ helm install --values loki.yaml loki grafana/loki -n loki
196273
d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"
197274
></path>
198275
</svg>
199-
</button></h3><p>Install Promtail using Helm:</p>
200-
<pre><code translate="no" class="language-shell">helm install --values promtail.yaml promtail grafana/promtail -n loki
276+
</button></h3><pre><code translate="no" class="language-shell">helm install --values promtail.yaml promtail grafana/promtail -n loki
201277
<button class="copy-code-btn"></button></code></pre>
202278
<h2 id="Query-Logs-with-Grafana" class="common-anchor-header">Query Logs with Grafana<button data-href="#Query-Logs-with-Grafana" class="anchor-icon" translate="no">
203279
<svg translate="no"

0 commit comments

Comments
 (0)