Install Grafana Loki as a Windows Service with AlwaysUp

How to Install Grafana Loki as a Windows Service with AlwaysUp

Automatically start your local installation of Loki in the background whenever your computer boots. Collect your important logs 24/7 — without anyone having to log on first.

Grafana Loki is an efficient log aggregation system inspired by Prometheus.

To install Loki as a Windows Service with AlwaysUp:

  1. Install Loki locally, if necessary.

    Configure Loki and ensure that it runs properly from the command line.

    For this tutorial, we placed the Loki executable in "C:\Grafana" and named our configuration file "config.yaml" (the default). Loki started as expected:

    Loki running from a command prompt

  2. Next, download and install AlwaysUp, if necessary.

  3. Start AlwaysUp.

  4. Select Application > Add to open the Add Application window:

    Add Application

  5. On the General tab:

    • In the Application field, enter the full path to your Loki executable — likely loki-windows-amd64.exe.

      That path is "C:\Grafana\loki-windows-amd64.exe" on our system.

    • If you run Loki with the "--config.file=" flag (or with any other parameters), enter the value in the Arguments field. However, since we have no parameters (we're using the default "config.yaml" file), we'll leave the field blank.

    • In the Start the application field, choose Automatically, but shortly after the computer boots. With this setting, Loki will start a couple of minutes after boot — after all the machine's critical services are completely up and running.

    • And in the Name field, enter the name that you will call the application in AlwaysUp. We suggest Loki but you can specify another name if you like.

    Loki Windows Service: General Tab

  6. Move to the Logon tab and enter the user name and password of the account where you're logged in and run Loki.

    While running in your account isn't mandatory, it's recommended because we know that your Loki installation works properly in that context. Loki may not perform the same in the System account, which might not have access to network resources.

    Loki Windows Service: Logon Tab

  7. When installed as a Windows Service, Loki will run invisibly in the background (on the isolated Session 0 desktop). Therefore, you won't see Loki's console window nor have access to text logged to the console.

    If lack of access to the console is a problem, you can capture Loki's console output to a text file. To do so:

    • Switch to the Extras tab.

    • In the Capture output to this log file field, enter the full path to the text file that should record the console output.

    • If important, specify what should happen to the output file if it grows large.

    Loki Windows Service: Extras Tab

  8. We're done configuring Loki as a Windows Service so click the Save button to record your settings.

    In a couple of seconds, an application called Loki (or whatever you called it) will show up in the AlwaysUp window. It is not yet running though so the state will be "Stopped":

    Loki Windows Service: Installed

  9. To start Loki from AlwaysUp, choose Application > Start "Loki".

    In a few seconds, the status will change to "Running" and Loki will be working in the background:

    Loki Windows Service: Running

    If you captured Loki's console output to a file (step 7), please open the file and check the contents. You should also check the status of Loki's services from your browser:

    Loki Windows Service: Check status

  10. That's it! Next time your computer boots, Loki will start up immediately, in the background, without anyone needing to log on. Please restart your PC now and test that everything works as expected after Windows returns to life.

    And please feel free to edit Loki in AlwaysUp and explore the many other settings that may be appropriate for your environment. For example, send an email if Loki stops, boost the application's priority, monitor the network port and much more.



Loki not working properly as a Windows Service?

  • Consult the AlwaysUp Troubleshooter — our online tool that can help you resolve the most common problems encountered when running an application as a Windows Service.

  • From AlwaysUp, select Application > Report Activity > Today to bring up an HTML report detailing the interaction between AlwaysUp and Loki. The AlwaysUp Event Log Messages page explains the messages that may appear.

  • Browse the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.

  • Contact us and we'll be happy to help!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 15.1 New!

7.9 MB Installer
Our 12,000+ customers include...
Compatible with Windows 11 Compatible with Windows Server 2022 Compatible with Windows 10
Over 94,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 19+ years!