{"id":129864,"date":"2025-06-18T11:36:37","date_gmt":"2025-06-18T11:36:37","guid":{"rendered":"\/tutorials\/?p=129864"},"modified":"2026-03-10T09:26:18","modified_gmt":"2026-03-10T09:26:18","slug":"how-to-install-loki","status":"publish","type":"post","link":"\/ca\/tutorials\/how-to-install-loki\/","title":{"rendered":"How to install Grafana Loki on Ubuntu"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p><strong>Grafana Loki<\/strong> is a horizontally scalable, open-source log aggregation system designed for efficiency and simplicity. Unlike traditional logging tools that index the full content of logs, Loki indexes only <strong>metadata<\/strong>, such as labels. This approach makes Loki more cost-effective and ideal for large-scale systems where performance is critical.<\/p><p>In this guide, you will learn how to:<\/p><ol class=\"wp-block-list\">\n<li><strong>Install Grafana Loki<\/strong> on an <strong>Ubuntu VPS<\/strong>.<\/li>\n\n\n\n<li><strong>Configure Loki<\/strong> to efficiently ingest logs from your services.<\/li>\n\n\n\n<li><strong>Integrate Grafana Loki<\/strong> with <strong>Grafana<\/strong> to visualize and query logs seamlessly.<\/li>\n<\/ol><p>By the end of this tutorial, you will have a fully operational Loki setup integrated with Grafana, ready to collect and display logs from your services.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites\"><strong>Prerequisites<\/strong><\/h2><p>Before you begin Loki installation, make sure your environment meets the following requirements:<\/p><ul class=\"wp-block-list\">\n<li><strong>Ubuntu 20.04<\/strong> or later as your VPS operating system.&nbsp;<\/li>\n\n\n\n<li><strong>Sudo<\/strong> or <strong>root<\/strong> access to perform system-level changes.<\/li>\n\n\n\n<li><a href=\"\/ca\/tutorials\/how-to-install-grafana\/\">Grafana installed<\/a> on your VPS. Hostinger offers a one-click Grafana installation template with our <a href=\"\/ca\/vps-hosting\">VPS hosting plans<\/a> to help you get started quickly.<\/li>\n\n\n\n<li>Terminal access via <a href=\"\/ca\/tutorials\/how-to-use-putty-ssh\/\"><strong>SSH<\/strong><\/a> or <strong>local shell<\/strong>.<\/li>\n\n\n\n<li>Basic familiarity with <a href=\"\/ca\/tutorials\/linux-commands\/\">Linux commands<\/a>.<\/li>\n\n\n\n<li>Basic tools installed:\n<ul class=\"wp-block-list\">\n<li><strong>wget<\/strong> to download files.<\/li>\n\n\n\n<li><strong>unzip<\/strong> to extract Loki binaries.<\/li>\n\n\n\n<li><strong>systemctl<\/strong> to manage systemd services.<\/li>\n<\/ul>\n<\/li>\n<\/ul><p>With these in place, you&rsquo;re ready to start installing Loki dependencies.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-install-grafana-loki\">How to install Grafana Loki? <\/h2><h3 class=\"wp-block-heading\" id=\"h-1-install-dependencies\"><strong>1. Install dependencies<\/strong><\/h3><p>Before installing Loki, make sure your system is up to date and has the necessary tools to handle downloads and file extraction.<\/p><p>First, ensure your package list and packages are up to date by running:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt update &amp;&amp; sudo apt upgrade -y<\/pre><ul class=\"wp-block-list\">\n<li><strong>apt update<\/strong> refreshes your package list.<\/li>\n\n\n\n<li><strong>apt upgrade -y<\/strong> ensures all installed packages are current.<\/li>\n<\/ul><p>Next, if you haven&rsquo;t yet, install <strong><a href=\"\/ca\/tutorials\/wget-command-examples\/\">wget<\/a><\/strong> and <strong><a href=\"\/ca\/tutorials\/how-to-unzip-files-linux\/\">unzip<\/a><\/strong>. Run:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install -y wget unzip<\/pre><p>Once these are in place, you&rsquo;re ready to download and install Loki.<\/p><h3 class=\"wp-block-heading\" id=\"h-2-download-and-install-loki\"><strong>2. Download and install Loki<\/strong><\/h3><p>Next, you&rsquo;ll download the latest Loki binary and set it up for system-wide access.<\/p><ol class=\"wp-block-list\">\n<li>Download the latest Loki release from GitHub by running:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">wget https:\/\/github.com\/grafana\/loki\/releases\/download\/v3.5.1\/loki-linux-amd64.zip<\/pre><p>Replace the version number above <strong>v3.5.1<\/strong> with the latest stable release from the <a href=\"https:\/\/github.com\/grafana\/loki\/releases\" target=\"_blank\" rel=\"noopener\">official Loki GitHub releases<\/a>.<br><\/p><ol start=\"2\" class=\"wp-block-list\">\n<li>Unzip the archive with <strong>unzip<\/strong>:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">unzip loki-linux-amd64.zip<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Make the binary executable:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">chmod +x loki-linux-amd64<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Move it to a system path:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo mv loki-linux-amd64 \/usr\/local\/bin\/loki<\/pre><p>The <strong>\/usr\/local\/bin directory<\/strong> is commonly used for user-installed programs, and makes the <strong>loki<\/strong> command accessible from anywhere in the terminal without specifying the full path.<\/p><ol start=\"5\" class=\"wp-block-list\">\n<li>Confirm Loki is installed:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">loki --version<\/pre><p>The terminal will return the version of the currently installed Loki, similar to this:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b00d78\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b00d78\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"319\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-version.png\/w=1024,h=1024,fit=scale-down\" alt=\"Terminal window showing results of loki --version command\" class=\"wp-image-129872\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>With Loki installed, the next step is setting up its configuration.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-configure-loki\"><strong>3. Configure Loki<\/strong><\/h3><p>Loki relies on a configuration file to define how it runs &ndash; everything from network ports to storage paths. Before running the service, you&rsquo;ll need to set this up properly.<\/p><ol class=\"wp-block-list\">\n<li>Create a directory for Loki configuration and move to it:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo mkdir -p \/etc\/loki\n\ncd \/etc\/loki<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Download the default config file:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo wget https:\/\/raw.githubusercontent.com\/grafana\/loki\/v3.5.1\/cmd\/loki\/loki-local-config.yaml -O config.yaml<\/pre><p>Grafana provides example configuration files. For a basic setup, we&rsquo;ll start with this local config.<\/p><p>Let&rsquo;s review the contents of the <strong>config.yaml <\/strong>file we downloaded and get familiar with. You can use <strong>nano<\/strong> or any other text editor available:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano config.yaml<\/pre><p>Once opened, you&rsquo;ll see a file similar to this:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">auth_enabled: false\n\nserver:\n\n&nbsp;&nbsp;http_listen_port: 3100\n\n&nbsp;&nbsp;grpc_listen_port: 9096\n\n&nbsp;&nbsp;log_level: debug\n\n&nbsp;&nbsp;grpc_server_max_concurrent_streams: 1000\n\ncommon:\n\n&nbsp;&nbsp;instance_addr: 127.0.0.1\n\n&nbsp;&nbsp;path_prefix: \/tmp\/loki\n\n&nbsp;&nbsp;storage:\n\n&nbsp;&nbsp;&nbsp;&nbsp;filesystem:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chunks_directory: \/tmp\/loki\/chunks\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rules_directory: \/tmp\/loki\/rules\n\n&nbsp;&nbsp;replication_factor: 1\n\n&nbsp;&nbsp;ring:\n\n&nbsp;&nbsp;&nbsp;&nbsp;kvstore:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store: inmemory\n\nquery_range:\n\n&nbsp;&nbsp;results_cache:\n\n&nbsp;&nbsp;&nbsp;&nbsp;cache:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;embedded_cache:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enabled: true\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;max_size_mb: 100\n\nlimits_config:\n\n&nbsp;&nbsp;metric_aggregation_enabled: true\n\nschema_config:\n\n&nbsp;&nbsp;configs:\n\n&nbsp;&nbsp;&nbsp;&nbsp;- from: 2020-10-24\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store: tsdb\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object_store: filesystem\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;schema: v13\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: index_\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;period: 24h\n\npattern_ingester:\n\n&nbsp;&nbsp;enabled: true\n\n&nbsp;&nbsp;metric_aggregation:\n\n&nbsp;&nbsp;&nbsp;&nbsp;loki_address: localhost:3100\n\nruler:\n\n&nbsp;&nbsp;alertmanager_url: http:\/\/localhost:9093\n\nfrontend:\n\n&nbsp;&nbsp;encoding: protobuf\n\nquerier:\n\n&nbsp;&nbsp;engine:\n\n&nbsp;&nbsp;&nbsp;&nbsp;enable_multi_variant_queries: true<\/pre><ul class=\"wp-block-list\">\n<li><strong>server:<\/strong> Defines the HTTP port and gRPC interfaces Loki listens on.<\/li>\n\n\n\n<li><strong>common:<\/strong> Defines settings shared across different components like <strong>ingesters<\/strong>, <strong>queriers<\/strong>, and <strong>distributors<\/strong>.<\/li>\n\n\n\n<li><strong>storage:<\/strong> Tells Loki where to store logs. It can be local or cloud storage, for example.<\/li>\n\n\n\n<li><strong>schema_config:<\/strong> Sets up how logs are indexed and stored over time.<\/li>\n<\/ul><p>For a minimal setup, you can use this config instead:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">auth_enabled: false\n\nserver:\n\n&nbsp;&nbsp;http_listen_port: 3100\n\n&nbsp;&nbsp;grpc_listen_port: 9096\n\ningester:\n\n&nbsp;&nbsp;lifecycler:\n\n&nbsp;&nbsp;&nbsp;&nbsp;ring:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kvstore:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store: inmemory\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replication_factor: 1\n\n&nbsp;&nbsp;chunk_idle_period: 5m\n\n&nbsp;&nbsp;max_chunk_age: 1h\n\n&nbsp;&nbsp;wal:\n\n&nbsp;&nbsp;&nbsp;&nbsp;enabled: true\n\n&nbsp;&nbsp;&nbsp;&nbsp;dir: \/var\/lib\/loki\/wal\n\nschema_config:\n\n&nbsp;&nbsp;configs:\n\n&nbsp;&nbsp;&nbsp;&nbsp;- from: 2024-01-01\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store: tsdb\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object_store: filesystem\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;schema: v13\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: index_\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;period: 24h\n\nstorage_config:\n\n&nbsp;&nbsp;tsdb_shipper:\n\n&nbsp;&nbsp;&nbsp;&nbsp;active_index_directory: \/var\/lib\/loki\/index\n\n&nbsp;&nbsp;&nbsp;&nbsp;cache_location: \/var\/lib\/loki\/cache\n\n&nbsp;&nbsp;filesystem:\n\n&nbsp;&nbsp;&nbsp;&nbsp;directory: \/var\/lib\/loki\/chunks\n\ncompactor:\n\n&nbsp;&nbsp;working_directory: \/var\/lib\/loki\/compactor\n\n&nbsp;&nbsp;compaction_interval: 10m\n\n&nbsp;&nbsp;retention_enabled: false\n\nlimits_config:\n\n&nbsp;&nbsp;allow_structured_metadata: false\n\nruler:\n\n&nbsp;&nbsp;storage:\n\n&nbsp;&nbsp;&nbsp;&nbsp;type: local\n\n&nbsp;&nbsp;&nbsp;&nbsp;local:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directory: \/tmp\/rules\n\n&nbsp;&nbsp;rule_path: \/tmp\/rules-temp\n\n&nbsp;&nbsp;enable_api: true<\/pre><p>This configuration uses local storage, which is ideal for small-scale VPS deployments. You can expand it later to use <strong>S3<\/strong>, <strong>GCS<\/strong>, or other backends for production use.<\/p><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> The provided configuration is valid for Loki v3.5.1. However, the requirements are constantly changing and may differ when you follow this guide.\n            <\/p><\/div>\n\n\n\n<\/p><p>The provided configuration is valid for Loki v3.5.1. However, the requirements are constantly changing and may differ when you follow this guide.<\/p><p>Next, we&rsquo;ll set up Loki to run as a <strong>systemd<\/strong> service.<\/p><h3 class=\"wp-block-heading\" id=\"h-4-run-loki-as-a-systemd-service\"><strong>4. Run Loki as a systemd service<\/strong><\/h3><p>To keep Loki running in the background and automatically start it on boot, we&rsquo;ll set it up as a <strong>systemd<\/strong> service.<\/p><ol class=\"wp-block-list\">\n<li>Create a new service unit file at <strong>\/etc\/systemd\/system\/loki.service<\/strong>:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano \/etc\/systemd\/system\/loki.service<\/pre><p>Paste in the following contents:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[Unit]\n\nDescription=Grafana Loki Log Aggregation System\n\nAfter=network.target\n\n[Service]\n\nType=simple\n\nExecStart=\/usr\/local\/bin\/loki -config.file=\/etc\/loki\/config.yaml\n\nRestart=on-failure\n\nUser=root\n\n[Install]\n\nWantedBy=multi-user.target<\/pre><p>Press <strong>CTRL + X<\/strong> to close, <strong>Y<\/strong> to save changes when prompted, and then <strong>ENTER<\/strong> to confirm.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\"> This unit file defines root as the user for Loki. Consider creating a dedicated user in production environments instead.<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><ol start=\"2\" class=\"wp-block-list\">\n<li>Reload systemd and start the Loki service:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl daemon-reexec\n\nsudo systemctl daemon-reload\n\nsudo systemctl start loki\n\nsudo systemctl enable loki<\/pre><ul class=\"wp-block-list\">\n<li><strong>daemon-reexec<\/strong> ensures changes take immediate effect on some systems.<\/li>\n\n\n\n<li><strong>daemon-reload<\/strong> reloads unit files.<\/li>\n\n\n\n<li><strong>enable<\/strong> makes sure Loki starts on boot.<\/li>\n<\/ul><ol start=\"3\" class=\"wp-block-list\">\n<li>Confirm the Loki service is running:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl status loki<\/pre><p>If the service is running, you will see output similar to this:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b0eb2d\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b0eb2d\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"493\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-status.png\/w=1024,h=1024,fit=scale-down\" alt=\"Terminal window showing Loki status as active\" class=\"wp-image-129876\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>If you&rsquo;re having issues, you can check Loki&rsquo;s logs:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">journalctl -u loki -f<\/pre><p>If everything was successful, you should see logs indicating Loki has started and is listening on port 3100.<br><\/p><p>With Loki running as a service, it&rsquo;s time to connect it to Grafana.<\/p><h3 class=\"wp-block-heading\" id=\"h-5-integrate-loki-with-grafana\"><strong>5. Integrate Loki with Grafana<\/strong><\/h3><p>We&rsquo;ll connect Loki to Grafana through Grafana&rsquo;s dashboard:<\/p><ol class=\"wp-block-list\">\n<li>Access Grafana in your browser by navigating to:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/&lt;your-server-ip&gt;:3000<\/pre><p>Replace<strong> &lt;your-server-ip&gt; <\/strong>with your actual VPS IP address or domain name.<\/p><ol start=\"2\" class=\"wp-block-list\">\n<li>Log in to Grafana. The default credentials are:<br><\/li>\n<\/ol><ul class=\"wp-block-list\">\n<li>Username: admin<\/li>\n\n\n\n<li>Password: admin<\/li>\n<\/ul><p>Grafana will prompt you to change the password after the first login, so make sure you choose secure credentials.<\/p><ol start=\"3\" class=\"wp-block-list\">\n<li>In the left-hand menu, go to <strong>Connections<\/strong> &rarr; <strong>Data sources<\/strong>:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b11d8c\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b11d8c\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"697\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/connections-datasources.png\/w=1024,h=1024,fit=scale-down\" alt=\"Grafana left side menu with Connections toggle open and Data sources selected\" class=\"wp-image-129877\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Click <strong>Add data source<\/strong>:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b142ba\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b142ba\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"718\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-add.png\/w=1024,h=1024,fit=scale-down\" alt=\"Data Sources section open in Grafana with Add data source button highlighted\" class=\"wp-image-129878\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Search for <strong>Loki<\/strong> and choose it from the list of available options:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b16c4e\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b16c4e\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"465\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-loki.png\/w=1024,h=1024,fit=scale-down\" alt=\"Add data source section open in Grafana with Loki highlighted\" class=\"wp-image-129879\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"6\" class=\"wp-block-list\">\n<li>In the <strong>URL<\/strong> field, enter:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/localhost:3100<\/pre><p>If Loki is running on a different server, use its IP address instead of <strong>localhost<\/strong>.<\/p><ol start=\"7\" class=\"wp-block-list\">\n<li>Click <strong>Save &amp; test<\/strong>:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b1925c\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b1925c\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"675\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/save-test.png\/w=1024,h=1024,fit=scale-down\" alt=\"Add data source wizard open in Grafana with save &amp; test button highlighted at the bottom.\" class=\"wp-image-129880\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Grafana will connect to Loki and confirm whether it&rsquo;s working. If successful, you will see a banner similar to this:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b1c4f9\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b1c4f9\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"255\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-added.png\/w=1024,h=1024,fit=scale-down\" alt='Green banner with text \"Data source successfully connected\"' class=\"wp-image-129881\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>You are now ready to start building dashboards and querying logs.<\/p><p>Next, we&rsquo;ll install Promtail to start collecting system logs and sending them to Loki.<\/p><h3 class=\"wp-block-heading\" id=\"h-6-install-promtail\"><strong>6. Install Promtail<\/strong><\/h3><p><strong>Promtail<\/strong> is Grafana Loki&rsquo;s official log shipper. It reads logs from files on your system, like <strong>\/var\/log\/syslog<\/strong>, attaches labels, and forwards them to Loki for storage and querying. It works much like a lightweight <strong>logstash<\/strong> or <strong>fluentd<\/strong>, but it&rsquo;s designed to integrate directly with Loki.<\/p><p>Let&rsquo;s set up Promtail to gather and ship <strong>syslog<\/strong> to Loki:<\/p><ol class=\"wp-block-list\">\n<li>Download and install Promtail:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">wget https:\/\/github.com\/grafana\/loki\/releases\/download\/v3.5.1\/promtail-linux-amd64.zip\n\nunzip promtail-linux-amd64.zip\n\nchmod +x promtail-linux-amd64\n\nsudo mv promtail-linux-amd64 \/usr\/local\/bin\/promtail<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Create a directory for Promtail&rsquo;s config and move to it:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo mkdir -p \/etc\/promtail\n\ncd \/etc\/promtail<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Download a sample Promtail config and save it as <strong>config.yaml<\/strong>:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo wget https:\/\/raw.githubusercontent.com\/grafana\/loki\/v3.5.1\/clients\/cmd\/promtail\/promtail-local-config.yaml -O config.yaml<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>You can instead create your own config for Promtail. Create and open a <strong>config.yam<\/strong>l file:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano config.yaml<\/pre><p>Write your config inside the file. You can use this minimal configuration:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">server:\n  http_listen_port: 9080\n  grpc_listen_port: 0\n\npositions:\n  filename: \/tmp\/positions.yaml\n\nclients:\n  - url: http:\/\/localhost:3100\/loki\/api\/v1\/push\n\nscrape_configs:\n  - job_name: system\n    static_configs:\n      - targets:\n          - localhost\n        labels:\n          job: syslog\n          __path__: \/var\/log\/syslog\n<\/pre><p>Press <strong>CTRL<\/strong> +<strong> X <\/strong>to close,<strong> Y <\/strong>to save changes when prompted, and then <strong>ENTER<\/strong> to confirm.<\/p><ol start=\"5\" class=\"wp-block-list\">\n<li>Create and open a service unit file for Promtail:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano \/etc\/systemd\/system\/promtail.service<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Paste the following config:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[Unit]\n\nDescription=Promtail log shipper for Grafana Loki\n\nAfter=network.target\n\n[Service]\n\nType=simple\n\nExecStart=\/usr\/local\/bin\/promtail -config.file=\/etc\/promtail\/config.yaml\n\nRestart=on-failure\n\n[Install]\n\nWantedBy=multi-user.target<\/pre><p>Press <strong>CTRL<\/strong> +<strong> X <\/strong>to close,<strong> Y <\/strong>to save changes when prompted, and then <strong>ENTER<\/strong> to confirm.<\/p><ol start=\"7\" class=\"wp-block-list\">\n<li>Reload <strong>systemd<\/strong> and start the Promtail service:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl daemon-reload\n\nsudo systemctl start promtail\n\nsudo systemctl enable promtail<\/pre><ol start=\"8\" class=\"wp-block-list\">\n<li>Check the status of the Promtail service:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo systemctl status promtail<\/pre><p>If everything starts up right, you&rsquo;ll see an output indicating that the service is active, similar to this:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b25b25\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b25b25\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"428\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/promtail-status.png\/w=1024,h=1024,fit=scale-down\" alt=\"Terminal window showing Promtail status as active\" class=\"wp-image-129882\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If the status is not active, you can check Promtail service logs and troubleshoot further:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">journalctl -u promtail -f<\/pre><p>When running, Promtail will begin forwarding logs to Loki, which you can now visualize and query inside Grafana.<\/p><h3 class=\"wp-block-heading\" id=\"h-7-verify-the-installation\"><strong>7. Verify the installation<\/strong><\/h3><p>Now that Loki and Promtail are up and running and Grafana is connected, it&rsquo;s time to verify that everything is working and logs are flowing correctly.<\/p><ol class=\"wp-block-list\">\n<li>Open the Grafana web interface and navigate to the <strong>Explore<\/strong> section in the left-hand menu:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b289a2\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b289a2\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"734\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/grafana-explore.png\/w=1024,h=1024,fit=scale-down\" alt=\"Grafana left side menu with Explore option selected\" class=\"wp-image-129883\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>In the top left of the panel, select Loki as the data source from the dropdown:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b2ad56\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b2ad56\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"700\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/explore-loki-source.png\/w=1024,h=1024,fit=scale-down\" alt=\"Explore panel open on Grafana, datasource selector dropdown open and Loki option highlighted\" class=\"wp-image-129884\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Select <strong>Code<\/strong> in the top right of the query editor to use <strong>LogQL<\/strong> expressions:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b2d2f9\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b2d2f9\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"512\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/query-editor-code.png\/w=1024,h=1024,fit=scale-down\" alt=\"Grafana explore query editor with Code option highlighted in the top right.\" class=\"wp-image-129885\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>If you used the sample Promtail config that tails <strong>\/var\/log\/syslog<\/strong>, in the query field enter:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{job=\"syslog\"}<\/pre><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\"> If you want to query logs containing &ldquo;error&rdquo;, you can use this query instead:<br>\n<br>\n<strong>{job=\"syslog\"} |= \"error\"<\/strong><br>\n<br>\nLogQL is a powerful querying language, and learning how to efficiently query your logs will help you troubleshoot effectively. You can learn more in the <a href=\"https:\/\/grafana.com\/docs\/loki\/latest\/query\/\" target=\"_blank\" rel=\"noopener\">official LogQL documentation<\/a>.<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><ol start=\"5\" class=\"wp-block-list\">\n<li>Press the <strong>Run query<\/strong> button at the top right:<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b2f95b\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b2f95b\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"427\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/run-query.png\/w=1024,h=1024,fit=scale-down\" alt=\"Grafana explore section open with Run query button highlighted at the top right\" class=\"wp-image-129887\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If everything is set up correctly, you should see real-time log entries appear in the panel, each entry with a timestamp, labels, and log message:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58f02b324e9\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58f02b324e9\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"518\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/logs-returned.png\/w=1024,h=1024,fit=scale-down\" alt=\"Grafana explore section open with logs displayed\" class=\"wp-image-129889\"  sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>These are being streamed from your VPSs&rsquo;<strong>\/var\/log\/syslog<\/strong> file through Promtail into Loki, and are now viewed in Grafana.<\/p><p>If no logs appear:<\/p><ul class=\"wp-block-list\">\n<li>Check Promtail logs for errors or issues:<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">journalctl -u promtail -f<\/pre><ul class=\"wp-block-list\">\n<li>Check Loki logs to confirm it&rsquo;s receiving data:<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">journalctl -u loki -f<\/pre><ul class=\"wp-block-list\">\n<li>Ensure Promtail is targeting the correct log file and the path in the config exists:<\/li>\n<\/ul><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano \/etc\/promtail\/config.yaml<\/pre><p>With logs visible in <strong>Explore<\/strong>, your Loki stack is live and ready for centralized logging and full-text search across your system.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\"><strong>Conclusion<\/strong><\/h2><p>By following this guide, you&rsquo;ve set up a full Grafana Loki stack on your Ubuntu VPS. You have also installed Loki and Promtail and integrated everything with Grafana for live log monitoring.<\/p><p>You now have centralized logging on your VPS &ndash; perfect for debugging, monitoring, and maintaining your infrastructure.<\/p><p>With this setup, you&rsquo;ll no longer dig through individual log files manually. Instead, you have a unified log interface, searchable by labels and timestamps, all from a clean Grafana dashboard.<\/p><p>Want to take it a step further? Add more log sources by configuring Promtail on other servers, build custom dashboards for application logs and alerting, or explore LogQL to create more advanced queries and filters.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-install-loki-faq\"><strong>How to install Loki FAQ<\/strong><\/h2><div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-69428eb8a4282\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What is Loki?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Loki is an open-source log system by Grafana Labs that indexes metadata only, making it faster and cheaper than traditional log tools. It works especially well with Prometheus for monitoring.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-69428eb8a4286\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What is Grafana Loki used for?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Grafana Loki enables centralized log monitoring and visualization. It lets developers collect, store, and query logs using LogQL in Grafanau0026mdash;ideal for troubleshooting, performance tracking, and understanding app behavior.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-69428eb8a4287\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">Can I use Loki without Promtail?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes, you can use Loki without Promtail. While Promtail is the default log shipper for Loki, other agents such as Fluent Bit, Logstash, or custom scripts can also send logs to Loki via its HTTP API. This flexibility lets you integrate Loki into existing logging setups.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Grafana Loki is a horizontally scalable, open-source log aggregation system designed for efficiency and simplicity. Unlike traditional logging tools that index the full content of logs, Loki indexes only metadata, such as labels. This approach makes Loki more cost-effective and ideal for large-scale systems where performance is critical. In this guide, you will learn how [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/how-to-install-loki\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":471,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to install Grafana Loki on Ubuntu","rank_math_description":"Learn how to install and configure Grafana Loki on Ubuntu. Set up log aggregation, connect it to Grafana, and start visualizing logs.","rank_math_focus_keyword":"install loki","footnotes":""},"categories":[22703,22699],"tags":[],"class_list":["post-129864","post","type-post","status-publish","format-standard","hentry","category-managing-monitoring-and-security","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-install-loki","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-install-loki","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-install-loki","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-install-loki","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-install-loki","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-install-loki","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-install-loki","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-install-loki","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/129864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/471"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=129864"}],"version-history":[{"count":11,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/129864\/revisions"}],"predecessor-version":[{"id":140764,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/129864\/revisions\/140764"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=129864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=129864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=129864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}