<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Monitoring on Grafana Labs</title><link>https://grafana.com/docs/loki/v2.9.x/setup/install/helm/monitor-and-alert/</link><description>Recent content in Monitoring on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/loki/v2.9.x/setup/install/helm/monitor-and-alert/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure monitoring and alerting</title><link>https://grafana.com/docs/loki/v2.9.x/setup/install/helm/monitor-and-alert/with-local-monitoring/</link><pubDate>Wed, 06 Sep 2023 12:47:18 +0000</pubDate><guid>https://grafana.com/docs/loki/v2.9.x/setup/install/helm/monitor-and-alert/with-local-monitoring/</guid><content><![CDATA[&lt;h1 id=&#34;configure-monitoring-and-alerting&#34;&gt;Configure monitoring and alerting&lt;/h1&gt;
&lt;p&gt;By default this Helm Chart configures meta-monitoring of metrics (service monitoring) and logs (self monitoring). This topic will walk you through configuring monitoring using a monitoring solution local to the same cluster where Loki is installed.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;ServiceMonitor&lt;/code&gt; resource works with either the Prometheus Operator or the Grafana Agent Operator, and defines how Loki&amp;rsquo;s metrics should be scraped. Scraping this Loki cluster using the scrape config defined in the &lt;code&gt;SerivceMonitor&lt;/code&gt; resource is required for the included dashboards to work. A &lt;code&gt;MetricsInstance&lt;/code&gt; can be configured to write the metrics to a remote Prometheus instance such as Grafana Cloud Metrics.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Self monitoring&lt;/em&gt; is enabled by default. This will deploy a &lt;code&gt;GrafanaAgent&lt;/code&gt;, &lt;code&gt;LogsInstance&lt;/code&gt;, and &lt;code&gt;PodLogs&lt;/code&gt; resource which will instruct the Grafana Agent Operator (installed seperately) on how to scrape this Loki cluster&amp;rsquo;s logs and send them back to itself. Scraping this Loki cluster using the scrape config defined in the &lt;code&gt;PodLogs&lt;/code&gt; resource is required for the included dashboards to work.&lt;/p&gt;
&lt;p&gt;Rules and alerts are automatically deployed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before you begin:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Helm 3 or above. See &lt;a href=&#34;https://helm.sh/docs/intro/install/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Installing Helm&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A running Kubernetes cluster with a running Loki deployment.&lt;/li&gt;
&lt;li&gt;A running Grafana instance.&lt;/li&gt;
&lt;li&gt;A running Prometheus Operator installed using the &lt;code&gt;kube-prometheus-stack&lt;/code&gt; Helm chart.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Prometheus Operator Prequisites&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The dashboards require certain metric labels to display Kubernetes metrics. The best way to accomplish this is to install the &lt;code&gt;kube-prometheus-stack&lt;/code&gt; Helm chart with the following values file, replacing &lt;code&gt;CLUSTER_NAME&lt;/code&gt; with the name of your cluster. The cluster name is what you specify during the helm installation, so a cluster installed with the command &lt;code&gt;helm install loki-cluster grafana/loki&lt;/code&gt; would be called &lt;code&gt;loki-cluster&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;kubelet:
  serviceMonitor:
    cAdvisorRelabelings:
      - action: replace
        replacement: &amp;lt;CLUSTER_NAME&amp;gt;
        targetLabel: cluster
      - targetLabel: metrics_path
        sourceLabels:
          - &amp;#34;__metrics_path__&amp;#34;
      - targetLabel: &amp;#34;instance&amp;#34;
        sourceLabels:
          - &amp;#34;node&amp;#34;

defaultRules:
  additionalRuleLabels:
    cluster: &amp;lt;CLUSTER_NAME&amp;gt;

&amp;#34;kube-state-metrics&amp;#34;:
  prometheus:
    monitor:
      relabelings:
        - action: replace
          replacement: &amp;lt;CLUSTER_NAME&amp;gt;
          targetLabel: cluster
        - targetLabel: &amp;#34;instance&amp;#34;
          sourceLabels:
            - &amp;#34;__meta_kubernetes_pod_node_name&amp;#34;

&amp;#34;prometheus-node-exporter&amp;#34;:
  prometheus:
    monitor:
      relabelings:
        - action: replace
          replacement: &amp;lt;CLUSTER_NAME&amp;gt;
          targetLabel: cluster
        - targetLabel: &amp;#34;instance&amp;#34;
          sourceLabels:
            - &amp;#34;__meta_kubernetes_pod_node_name&amp;#34;

prometheus:
  monitor:
    relabelings:
      - action: replace
        replacement: &amp;lt;CLUSTER_NAME&amp;gt;
        targetLabel: cluster&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;kube-prometheus-stack&lt;/code&gt; installs &lt;code&gt;ServiceMonitor&lt;/code&gt; and &lt;code&gt;PrometheusRule&lt;/code&gt; resources for monitoring Kubernetes, and it depends on the &lt;code&gt;kube-state-metrics&lt;/code&gt; and &lt;code&gt;prometheus-node-exporter&lt;/code&gt; helm charts which also install &lt;code&gt;ServiceMonitor&lt;/code&gt; resources for collecting &lt;code&gt;kubelet&lt;/code&gt; and &lt;code&gt;node-exporter&lt;/code&gt; metrics. The above values file adds the necessary additional labels required for these metrics to work with the included dashboards.&lt;/p&gt;
&lt;p&gt;If you are using this helm chart in an environment which does not allow for the installation of &lt;code&gt;kube-prometheus-stack&lt;/code&gt; or custom CRDs, you should run &lt;code&gt;helm template&lt;/code&gt; on the &lt;code&gt;kube-prometheus-stack&lt;/code&gt; helm chart with the above values file, and review all generated &lt;code&gt;ServiceMonitor&lt;/code&gt; and &lt;code&gt;PrometheusRule&lt;/code&gt; resources. These resources may have to be modified with the correct ports and selectors to find the various services such as &lt;code&gt;kubelet&lt;/code&gt; and &lt;code&gt;node-exporter&lt;/code&gt; in your environment.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To install the dashboards:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Dashboards are enabled by default. Set &lt;code&gt;monitoring.dashboards.namespace&lt;/code&gt; to the namespace of the Grafana instance if it is in a different namespace than this Loki cluster.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Dashbards must be mounted to your Grafana container. The dashboards are in &lt;code&gt;ConfigMap&lt;/code&gt;s named &lt;code&gt;loki-dashboards-1&lt;/code&gt; and &lt;code&gt;loki-dashboards-2&lt;/code&gt; for Loki, and &lt;code&gt;enterprise-logs-dashboards-1&lt;/code&gt; and &lt;code&gt;enterprise-logs-dashboards-2&lt;/code&gt; for GEL. Mount them to &lt;code&gt;/var/lib/grafana/dashboards/loki-1&lt;/code&gt; and &lt;code&gt;/var/lib/grafana/dashboards/loki-2&lt;/code&gt; in your Grafana container.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a dashboard provisioning file called &lt;code&gt;dashboards.yaml&lt;/code&gt; in &lt;code&gt;/etc/grafana/provisioning/dashboards&lt;/code&gt; of your Grafana container with the following contents (&lt;em&gt;note&lt;/em&gt;: you may need to edit the &lt;code&gt;orgId&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;---
apiVersion: 1
providers:
  - disableDeletion: true
    editable: false
    folder: Loki
    name: loki-1
    options:
      path: /var/lib/grafana/dashboards/loki-1
    orgId: 1
    type: file
  - disableDeletion: true
    editable: false
    folder: Loki
    name: loki-2
    options:
      path: /var/lib/grafana/dashboards/loki-2
    orgId: 1
    type: file&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;To add add additional Prometheus rules:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Modify the configuration file &lt;code&gt;values.yaml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;monitoring:
  rules:
    additionalGroups:
      - name: loki-rules
        rules:
          - record: job:loki_request_duration_seconds_bucket:sum_rate
            expr: sum(rate(loki_request_duration_seconds_bucket[1m])) by (le, job)
          - record: job_route:loki_request_duration_seconds_bucket:sum_rate
            expr: sum(rate(loki_request_duration_seconds_bucket[1m])) by (le, job, route)
          - record: node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate
            expr: sum(rate(container_cpu_usage_seconds_total[1m])) by (node, namespace, pod, container)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;To disable monitoring:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Modify the configuration file &lt;code&gt;values.yaml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;selfMonitoring:
  enabled: false

serviceMonitor:
  enabled: false&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;To use a remote Prometheus and Loki instance such as Grafana Cloud&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a &lt;code&gt;secrets.yaml&lt;/code&gt; file with credentials to access the Grafana Cloud services:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;---
apiVersion: v1
kind: Secret
metadata:
  name: primary-credentials-metrics
  namespace: default
stringData:
  username: &amp;#34;&amp;lt;instance ID&amp;gt;&amp;#34;
  password: &amp;#34;&amp;lt;API key&amp;gt;&amp;#34;
---
apiVersion: v1
kind: Secret
metadata:
  name: primary-credentials-logs
  namespace: default
stringData:
  username: &amp;#34;&amp;lt;instance ID&amp;gt;&amp;#34;
  password: &amp;#34;&amp;lt;API key&amp;gt;&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the secret to Kubernetes with &lt;code&gt;kubectl create -f secret.yaml&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a &lt;code&gt;remoteWrite&lt;/code&gt; section to &lt;code&gt;serviceMonitor&lt;/code&gt; in &lt;code&gt;values.yaml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;monitoring:
...
  serviceMonitor:
    enabled: true
    ...
    metricsInstance:
      remoteWrite:
      - url: &amp;lt;metrics remote write endpoint&amp;gt;
        basicAuth:
          username:
            name: primary-credentials-metrics
            key: username
          password:
            name: primary-credentials-metrics
            key: password&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a client to &lt;code&gt;monitoring.selfMonitoring.logsInstance.clients&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;monitoring:
---
selfMonitoring:
  enabled: true
  logsInstance:
    clients:
      - url: &amp;lt;logs remote write endpoint&amp;gt;
        basicAuth:
          username:
            name: primary-credentials-logs
            key: username
          password:
            name: primary-credentials-logs
            key: password
lokiCanary:
  enabled: false&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the &lt;code&gt;Loki meta-motoring&lt;/code&gt; connection on Grafana Cloud.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="configure-monitoring-and-alerting">Configure monitoring and alerting&lt;/h1>
&lt;p>By default this Helm Chart configures meta-monitoring of metrics (service monitoring) and logs (self monitoring). This topic will walk you through configuring monitoring using a monitoring solution local to the same cluster where Loki is installed.&lt;/p></description></item><item><title>Configure monitoring and alerting of Loki using Grafana Cloud</title><link>https://grafana.com/docs/loki/v2.9.x/setup/install/helm/monitor-and-alert/with-grafana-cloud/</link><pubDate>Mon, 18 Sep 2023 12:10:25 +0000</pubDate><guid>https://grafana.com/docs/loki/v2.9.x/setup/install/helm/monitor-and-alert/with-grafana-cloud/</guid><content><![CDATA[&lt;h1 id=&#34;configure-monitoring-and-alerting-of-loki-using-grafana-cloud&#34;&gt;Configure monitoring and alerting of Loki using Grafana Cloud&lt;/h1&gt;
&lt;p&gt;This topic will walk you through using Grafana Cloud to monitor a Loki installation that is installed with the Helm chart. This approach leverages many of the chart&amp;rsquo;s &lt;em&gt;self monitoring&lt;/em&gt; features, but instead of sending logs back to Loki itself, it sends them to a Grafana Cloud Logs instance. This approach also does not require the installation of the Prometheus Operator and instead sends metrics to a Grafana Cloud Metrics instance. Using Grafana Cloud to monitor Loki has the added benefit of being able to troubleshoot problems with Loki when the Helm installed Loki is down, as the logs will still be available in the Grafana Cloud Logs instance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before you begin:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Helm 3 or above. See &lt;a href=&#34;https://helm.sh/docs/intro/install/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Installing Helm&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A Grafana Cloud account and stack (including Cloud Grafana, Cloud Metrics, and Cloud Logs)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/grafana-cloud/monitor-infrastructure/kubernetes-monitoring/configuration/config-k8s-agent-flow/&#34;&gt;Grafana Kubernetes Monitoring using Agent Flow&lt;/a&gt; configured for the Kubernetes cluster.&lt;/li&gt;
&lt;li&gt;A running Loki deployment installed in that Kubernetes cluster via the Helm chart&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Prequisites for Monitoring Loki:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You must setup the Grafana Kubernetes Integration following the instructions in &lt;a href=&#34;/docs/grafana-cloud/monitor-infrastructure/kubernetes-monitoring/configuration/config-k8s-agent-flow/&#34;&gt;Grafana Kubernetes Monitoring using Agent Flow&lt;/a&gt; as this will install necessary components for collecting metrics about your Kubernetes cluster and sending them to Grafana Cloud. Many of the dashboards installed as a part of the Loki integration rely on these metrics.&lt;/p&gt;
&lt;p&gt;Walking through this installation will create two Grafana Agent configurations, one for metrics and one for logs, that will add the external label &lt;code&gt;cluster: cloud&lt;/code&gt;. In order for the Dashboards in the self-hosted Grafana Loki integration to work, the cluster name needs to match your Helm installation name. If you installed Loki using the command &lt;code&gt;helm install best-loki-cluster grafana/loki&lt;/code&gt;, you would need to change the &lt;code&gt;cluster&lt;/code&gt; value in both Grafana Agent configurations from &lt;code&gt;cloud&lt;/code&gt; to &lt;code&gt;best-loki-cluster&lt;/code&gt; when setting up the Grafana Kubernetes integration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To set up the Loki integration in Grafana Cloud:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Get valid Push credentials for your Cloud Metrics and Cloud Logs instances.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a secret in the same namespace as Loki to store your Cloud Logs credentials.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;cat &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | NAMESPACE=loki /bin/sh -c &amp;#39;kubectl apply -n $NAMESPACE -f -&amp;#39;
apiVersion: v1
data:
  password: &amp;lt;BASE64_ENCODED_CLOUD_LOGS_PASSWORD&amp;gt;
  username: &amp;lt;BASE64_ENCODED_CLOUD_LOGS_USERNAME&amp;gt;
kind: Secret
metadata:
  name: grafana-cloud-logs-credentials
type: Opaque
EOF&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a secret to store your Cloud Metrics credentials.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;cat &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | NAMESPACE=loki /bin/sh -c &amp;#39;kubectl apply -n $NAMESPACE -f -&amp;#39;
apiVersion: v1
data:
  password: &amp;lt;BASE64_ENCODED_CLOUD_METRICS_PASSWORD&amp;gt;
  username: &amp;lt;BASE64_ENCODED_CLOUD_METRICS_USERNAME&amp;gt;
kind: Secret
metadata:
  name: grafana-cloud-metrics-credentials
type: Opaque
EOF&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable monitoring metrics and logs for the Loki installation to be sent your cloud database instances by adding the following to your Helm &lt;code&gt;values.yaml&lt;/code&gt; file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;---
monitoring:
  dashboards:
    enabled: false
  rules:
    enabled: false
  selfMonitoring:
    logsInstance:
      clients:
        - url: &amp;lt;CLOUD_LOGS_URL&amp;gt;
          basicAuth:
            username:
              name: grafana-cloud-logs-credentials
              key: username
            password:
              name: grafana-cloud-logs-credentials
              key: password
  serviceMonitor:
    metricsInstance:
      remoteWrite:
        - url: &amp;lt;CLOUD_METRICS_URL&amp;gt;
          basicAuth:
            username:
              name: grafana-cloud-metrics-credentials
              key: username
            password:
              name: grafana-cloud-metrics-credentials
              key: password&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the self-hosted Grafana Loki integration by going to your hosted Grafana instance, selecting &lt;strong&gt;Connections&lt;/strong&gt; from the Home menu, then search for and install the &lt;strong&gt;Self-hosted Grafana Loki&lt;/strong&gt; integration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once the self-hosted Grafana Loki integration is installed, click the &lt;strong&gt;View Dashboards&lt;/strong&gt; button to see the installed dashboards.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="configure-monitoring-and-alerting-of-loki-using-grafana-cloud">Configure monitoring and alerting of Loki using Grafana Cloud&lt;/h1>
&lt;p>This topic will walk you through using Grafana Cloud to monitor a Loki installation that is installed with the Helm chart. This approach leverages many of the chart&amp;rsquo;s &lt;em>self monitoring&lt;/em> features, but instead of sending logs back to Loki itself, it sends them to a Grafana Cloud Logs instance. This approach also does not require the installation of the Prometheus Operator and instead sends metrics to a Grafana Cloud Metrics instance. Using Grafana Cloud to monitor Loki has the added benefit of being able to troubleshoot problems with Loki when the Helm installed Loki is down, as the logs will still be available in the Grafana Cloud Logs instance.&lt;/p></description></item></channel></rss>