{"id":129864,"date":"2025-06-18T11:36:37","date_gmt":"2025-06-18T11:36:37","guid":{"rendered":"\/tutorials\/?p=129864"},"modified":"2026-03-09T19:16:27","modified_gmt":"2026-03-09T19:16:27","slug":"how-to-install-loki","status":"publish","type":"post","link":"\/ng\/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=\"\/ng\/tutorials\/how-to-install-grafana\">Grafana installed<\/a> on your VPS. Hostinger offers a one-click Grafana installation template with our <a href=\"\/ng\/vps-hosting\">VPS hosting plans<\/a> to help you get started quickly.<\/li>\n\n\n\n<li>Terminal access via <a href=\"\/ng\/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=\"\/ng\/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=\"\/ng\/tutorials\/wget-command-examples\">wget<\/a><\/strong> and <strong><a href=\"\/ng\/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\">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\":\"69e1dc9de65dc\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-version.png\/public\" alt=\"Terminal window showing results of loki --version command\" class=\"wp-image-129872\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-version.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-version.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-version.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-version.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-version.png\/w=768,fit=scale-down 768w\" 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-async--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><p class=\"important\"><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.<\/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                    <h4 class=\"title\">Pro tip<\/h4>\n                    <p> 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<\/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\":\"69e1dc9de9323\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-status.png\/public\" alt=\"Terminal window showing Loki status as active\" class=\"wp-image-129876\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-status.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-status.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-status.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-status.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/loki-status.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9debd46\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/connections-datasources.png\/public\" alt=\"Grafana left side menu with Connections toggle open and Data sources selected\" class=\"wp-image-129877\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/connections-datasources.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/connections-datasources.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/connections-datasources.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/connections-datasources.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/connections-datasources.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9dee7c1\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-add.png\/public\" alt=\"Data Sources section open in Grafana with Add data source button highlighted\" class=\"wp-image-129878\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-add.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-add.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-add.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-add.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-add.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9df161e\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-loki.png\/public\" alt=\"Add data source section open in Grafana with Loki highlighted\" class=\"wp-image-129879\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-loki.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-loki.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-loki.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-loki.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-loki.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9e00006\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/save-test.png\/public\" alt=\"Add data source wizard open in Grafana with save &amp; test button highlighted at the bottom.\" class=\"wp-image-129880\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/save-test.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/save-test.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/save-test.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/save-test.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/save-test.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9e02df9\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-added.png\/public\" alt='Green banner with text \"Data source successfully connected\"' class=\"wp-image-129881\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-added.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-added.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-added.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-added.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/datasource-added.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9e06231\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/promtail-status.png\/public\" alt=\"Terminal window showing Promtail status as active\" class=\"wp-image-129882\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/promtail-status.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/promtail-status.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/promtail-status.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/promtail-status.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/promtail-status.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9e08ded\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/grafana-explore.png\/public\" alt=\"Grafana left side menu with Explore option selected\" class=\"wp-image-129883\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/grafana-explore.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/grafana-explore.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/grafana-explore.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/grafana-explore.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/grafana-explore.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9e0b4e2\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/explore-loki-source.png\/public\" alt=\"Explore panel open on Grafana, datasource selector dropdown open and Loki option highlighted\" class=\"wp-image-129884\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/explore-loki-source.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/explore-loki-source.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/explore-loki-source.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/explore-loki-source.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/explore-loki-source.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9e0de47\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/query-editor-code.png\/public\" alt=\"Grafana explore query editor with Code option highlighted in the top right.\" class=\"wp-image-129885\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/query-editor-code.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/query-editor-code.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/query-editor-code.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/query-editor-code.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/query-editor-code.png\/w=768,fit=scale-down 768w\" 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-async--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                    <h4 class=\"title\">Pro tip<\/h4>\n                    <p> 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\/\">official LogQL documentation<\/a>.<\/p>\n                <\/div>\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\":\"69e1dc9e1084d\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/run-query.png\/public\" alt=\"Grafana explore section open with Run query button highlighted at the top right\" class=\"wp-image-129887\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/run-query.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/run-query.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/run-query.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/run-query.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/run-query.png\/w=768,fit=scale-down 768w\" 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-async--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\":\"69e1dc9e12dc1\"}' data-wp-interactive=\"core\/image\" 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-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/logs-returned.png\/public\" alt=\"Grafana explore section open with logs displayed\" class=\"wp-image-129889\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/logs-returned.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/logs-returned.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/logs-returned.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/logs-returned.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2025\/06\/logs-returned.png\/w=768,fit=scale-down 768w\" 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-async--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 class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1750246427922\"><h3 class=\"schema-faq-question\"><strong>What is Loki?<\/strong><\/h3> <p class=\"schema-faq-answer\">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> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1750246438415\"><h3 class=\"schema-faq-question\"><strong>What is Grafana Loki used for?<\/strong><\/h3> <p class=\"schema-faq-answer\">Grafana Loki enables centralized log monitoring and visualization. It lets developers collect, store, and query logs using LogQL in Grafana&mdash;ideal for troubleshooting, performance tracking, and understanding app behavior.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1750246443934\"><h3 class=\"schema-faq-question\"><strong>Can I use Loki without Promtail?<\/strong><\/h3> <p class=\"schema-faq-answer\">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> <\/div> <\/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=\"\/ng\/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":[22644],"tags":[],"class_list":["post-129864","post","type-post","status-publish","format-standard","hentry","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-UK","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\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/129864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/471"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=129864"}],"version-history":[{"count":10,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/129864\/revisions"}],"predecessor-version":[{"id":143214,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/129864\/revisions\/143214"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=129864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=129864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=129864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}