-
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:
-
Next, download and install AlwaysUp, if necessary.
-
Start AlwaysUp.
-
Select Application > Add to open the Add Application window:
-
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.
-
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.
-
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.
-
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":
-
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:
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:
-
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.